.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>