按钮-全选复选框
1..................
<script>
function sel()
{
o=document.getElementsByName("chkbox")
for(i=0;i<o.length;i++)
o[i].checked=event.srcElement.checked
}
</script>
<input type="checkbox" onclick='sel()'>圈选<br>
<input type="checkbox" name="chkbox"><input type="checkbox" name="chkbox"><input type="checkbox" name="chkbox"><input type="checkbox" name="chkbox"><input type="checkbox" name="chkbox">
2...................
<input type='checkbox' name='Chk1' id='chk_fun' value='1' >
<input type='checkbox' name='Chk2' id='chk_fun' value='1' >
<input type='checkbox' name='Chk3' id='chk_fun' value='1' >
<input type='checkbox' name='Chk4' id='chk_fun' value='1' >
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;}
checkflag = "true";
return "取消全选"; }
else {
for (i = 0; i < field.length; i++) {
field[i].checked = false; }
checkflag = "false";
return "再全选"; }
}
// End -->
</script>
<input type=button value="全选" onClick="this.value=check(document.all.chk_fun)">