<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script>
function changeColor() {
var table1 = document.getElementById("dataTable");
var count = table1.rows.length;
for(var i = 0;i < count;i++) {
if(i%2 == 0) {
table1.rows[i].style.backgroundColor = "#00FF00";
}
else {
table1.rows[i].style.backgroundColor = "#FFEE00";
}
}
}
function checkAll() {
var selectAll = document.getElementById("selectAll");
var otherCheckbox = document.getElementsByName("ids");
if(selectAll.checked == true) {
for(var i = 0;i < otherCheckbox.length;i++) {
otherCheckbox[i].checked = true;
}
}
else {
for(var i = 0;i < otherCheckbox.length;i++) {
otherCheckbox[i].checked = false;
}
}
}
</script>
</head>
<body onload="changeColor()">
<table border = "1" width = "80%" align="center" id="dataTable">
<tr>
<th><input type="checkbox" id="selectAll" onclick="checkAll()" /></th>
<th>分类ID</th>
<th>分类名称</th>
<th>分类描述</th>
<th>操作</th>
</tr>
<tr>
<td>
<input type="checkbox" name="ids" />
</td>
<td>1</td>
<td>手机数码</td>
<td>手机数码</td>
<td><a href="">修改</a>|<a href="">删除</a></td>
</tr>
<tr>
<td>
<input type="checkbox" name="ids" />
</td>
<td>2</td>
<td>烟酒糖茶</td>
<td>烟酒糖茶</td>
<td><a href="">修改</a>|<a href="">删除</a></td>
</tr>
<tr>
<td>
<input type="checkbox" name="ids" />
</td>
<td>3</td>
<td>鞋靴箱包</td>
<td>鞋靴箱包</td>
<td><a href="">修改</a>|<a href="">删除</a></td>
</tr>
</table>
</body>
</html>