文字形式全选复选框

http://www.corange.cn/archives/2008/10/2058.html

<scrīpt language="text/javascrīpt">

var checkflag = false;
function check(field) {
if (!checkflag) {
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 "全选";
}
}
</scrīpt>

<a href="#" ōnclick="this.innerHTML=check(document.getElementsByName('title'))">全选</a>

<input type="checkbox" class="submitsbg" name="title[]" value="测试">
<input type="checkbox" class="submitsbg" name="title[]" value="成功">
<input type="checkbox" class="submitsbg" name="title[]" value="选择">
<input type="checkbox" class="submitsbg" name="title[]" value="我的">

你可能感兴趣的:(复选框)