js的行变色的鼠标事件代码

 <style type="text/css">
    .one {
background-color:#660;}
.two {
background-color:#9F0;}
.over {
background-color:#F69;}
    </style>
    <script type="text/javascript">
function cY() {
var name;
    var idNode = document.getElementById("info");//获得table的id节点
var cNode = idNode.rows;

for(var x=1; x<cNode.length-1; x++) {

//遍历隔行的颜色设置成两种颜色

if(x%2==1) { 
cNode[x].className = "one";

}else {cNode[x].className = "two";}

//onmouseover 事件会在鼠标指针移动到指定的对象上时发生颜色改变

cNode[x].onmouseover = function() {
name = this.className;
this.className = "over";
}
cNode[x].onmouseout = function() {
this.className = name;
}
}
}
onload = function () {
cY();
}
    </script>

</head>

<body>
<table id="info">
    <tr>
        <th>
    <input type="checkbox" name="it" οnclick="getSum"  />全选
            </th>
    <th>收件人</th>
        <th>邮件名称</th>
        <th>邮件附属信息</th>
        </tr>
      
        <tr>
        <td>
            <input type="checkbox" name="m" />
            </td>
            <td>张三11</td>
            <td>我的邮件名称11</td>
            <td>邮件附属信息11</td>
        </tr>
        <tr>
        <td>
            <input type="checkbox" name="m" />
            </td>
            <td>张三11</td>
            <td>我的邮件名称11</td>
            <td>邮件附属信息11</td>
        </tr>
       
      
        <tr>
        <th>
        <input type="checkbox" name="ty"  />全选
            </th>
            <th colspan="3">
            <input type="button" value="全选" />
                <input type="button" value="取消全选" />
                <input type="button" value="反选" />
                <input type="button" value="删除所选材料" />
            </th>
        </tr>
    </table>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值