<html>
<head>
<meta charset="utf-8">
<script>
//全选
function a()
{
var selects = document.getElementsByName('ids');
for(var i=0;i<selects.length;i++)
{
selects[i].checked=true;
}
}
function c(){
var selects = document.getElementsByName("ids");
for(var i=0;i<selects.length;i++){
selects[i].checked=false;
}
}
function b(){
var selects = document.getElementsByName("ids");
for(var i=0;i<selects.length;i++){
if(selects[i].checked==true){
selects[i].checked=false;
}
else{
selects[i].checked=true;
}
}
}
</script>
</head>
<body>
<table>
<tr>
<td><input type="checkbox" name="ids" ></td>
<td>喵喵</td>
<td>2012-2-28</td>
</tr>
<tr>
<td><input type="checkbox" name="ids" ></td>
<td>嘿嘿</td>
<td>2012-2-27</td>
</tr>
<tr>
<td><input type="checkbox" name="ids" ></td>
<td>嘻嘻</td>
<td>2012-2-26</td>
</tr>
<tr>
<td><input type="button" value="全选" XonClick="a()" ></td>
<td><input type="button" value="反选" XonClick="b()"></td>
<td><input type="button" value="全不选" XonClick="c()"></td>
</tr>
</table>
</body>
</html>