<html>
<input type="checkbox" οnclick="fun('c')">全选 <br>
选中<input type="checkbox" id='1' name="c"><br>
选中<input type="checkbox" id='2' name="c"><br>
选中<input type="checkbox" id='3' name="c"><br>
选中<input type="checkbox" id='4' name="c"><br>
选中<input type="checkbox" id='5' name="c"><br>
选中<input type="checkbox" id='6' name="c"><br>
</html>
<script type="text/javascript">
function fun(gname){
var cs=document.getElementsByName(gname);
for(i=0;i<cs.length;i++){
cs[i].checked=event.srcElement.checked;
}
}
</script>