CSDN博客

img ziyou_jo

按钮-全选复选框

发表于2005/1/3 21:31:00  841人阅读

<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)">

0 0

相关博文

我的热门文章

img
取 消
img