<html>
<body>
<script language="javascript">
function selectAll()
{
var arrObj = document.form1.checkbox1;
for(var i = 0; i < arrObj.length;i++)
{
if(typeof arrObj[i].type != "undefined" && arrObj[i].type=='checkbox') arrObj[i].checked =true;
}
}
function unSelectAll()
{
var arrObj = document.form1.checkbox1;
for(var i = 0; i < arrObj.length;i++)
{
if(typeof arrObj[i].type != "undefined" && arrObj[i].type=='checkbox') arrObj[i].checked =false;
}
}
</script>
<form name="form1">
<input type=checkbox name=checkbox1 value="1"> d
<input type=checkbox name=checkbox1 value="2"> d
<input type=checkbox name=checkbox1 value="3">
<input type=checkbox name=checkbox1 value="4">
<input type=checkbox name=checkbox1 value="5">
<input type=checkbox name=checkbox1 value="6">
<input type=checkbox name=checkbox2 value="41"> 2
<input type=checkbox name=checkbox2 value="278"> 2
<input type="button" value="全选" onClick="selectAll()">
<input type="button" value="全部不选" onClick="unSelectAll()">
</form>
</body>
</html>