• jQuery写隔行变色


        <style type="text/css">         body {           font-size:12px;text-align:center;         }         #tbStu {            260px;border:1px solid #666;background-color:#eee;          }             #tbStu tr {               line-height:23px;             }                 #tbStu tr th {                  background-color:#ccc;color:#fff;                 }             #tbStu .trOdd {               background-color:#fff;             }     </style>     <script src="jQuery/jquery-1.9.1.js"></script>     <script type="text/javascript">

            //普通JS写法         //window.onload = function () {         //    var oTb = document.getElementById('tbStu');         //    for (var i = 0; i < oTb.rows.length-1; i++) {         //        if (i % 2)         //        {         //            oTb.rows[i].className = "trOdd";         //        }         //    }         //}

            //jQuery选择器写法(选择table的行,隔一行,选择一行)

            $(function () {             $('#tbStu tr:nth-child(even)').addClass("trOdd");             //jQuery给一个DIV复制内容时,不需要检测该DIV是否存在             //  $('#divMain').html('这是一个检测页面');         })     </script> </head> <body>     <table id="tbStu" cellpadding="0" cellspacing="0" >         <tbody>               <tr>                   <th>学号</th><th>姓名</th><th>性别</th><th>部分</th>               </tr>               <tr>                   <td>1001</td><td>张小明</td><td>男</td><td>320</td>               </tr>               <tr>                   <td>1002</td><td>李明琪</td><td>女</td><td>350</td>               </tr>               <tr>                  <td>1003</td><td>张三</td><td>男</td><td>150</td>               </tr>         </tbody>     </table> </body>

  • 相关阅读:
    oracle 数据库关闭的的几种方式总结
    oracle热备份
    oracle 的 startup,startup mount,startup nomount之间的区别
    Oracle数据导入导出imp/exp命令总结
    oracle模糊查询效率可这样提高
    流程控制
    常量
    java序列化
    JVM锁说明
    go变量和数据类型
  • 原文地址:https://www.cnblogs.com/qiqiBoKe/p/3028459.html
Copyright © 2020-2023  润新知