zoukankan      html  css  js  c++  java
  • js控制表格隔行变色

    只是加载时候隔行变一个颜色,鼠标滑动上去时候没有变化

    <table width="800" border="0" cellpadding="0" cellspacing="0">

    <tr>
    <td>不变色</td>
    </tr>
    <tbody id="goaler">
    <tr>
    <td>xxxxxxxx</td>
    </tr>
    <tr>
    <td>xxxxxxxx</td>
    </tr>
    <tr>
    <td>xxxxxxxx</td>
    </tr>
    <tr>
    <td>xxxxxxxx</td>
    </tr>
    </tbody>
    <tr>
    <td>不变色</td>
    </tr>
    </table>
     
    <script language="JavaScript">
    <!--
    var TbRow = document.getElementById("goaler");
    if (TbRow != null)
    {
    for (var i=0;i<TbRow.rows.length ;i++ )
    {
    if (TbRow.rows[i].rowIndex%2==1)
    {
    TbRow.rows[i].style.backgroundColor="";
    }
    else
    {
    TbRow.rows[i].style.backgroundColor="#F1F1F1";
    }
    }
    }
    //-->
    </script>
  • 相关阅读:
    HDU
    POJ
    POJ
    POJ
    POJ
    POJ
    POJ
    SPFA算法——最短路径
    POJ1251 Jungle Roads Kruskal+scanf输入小技巧
    MongoDB--关于数据库及选择MongoDB的原因
  • 原文地址:https://www.cnblogs.com/ITzhangyunpeng/p/9361583.html
Copyright © 2011-2022 走看看