// --列头全选框被单击---
function ChkAllClick(all){
var arrSon = document.getElementsByName('chkSon');
var checked = all.checked;
for(i=0;i<arrSon.length;i++) {
arrSon[i].checked = checked;
}
}
// --子项复选框被单击---
function ChkSonClick(son) {
if(!son.checked)
$('chkAll').checked = null;
}
</script>
<input type="checkbox" onclick="ChkAllClick(this)" id="chkAll" onfocus="this.blur();" />
全选
<input name="chkSon" type="checkbox" onclick="ChkSonClick(this)"
value="1" onfocus="this.blur();" />1
<input name="chkSon" type="checkbox" onclick="ChkSonClick(this)"
value="2" onfocus="this.blur();" />2
<input name="chkSon" type="checkbox" onclick="ChkSonClick(this)"
value="3" onfocus="this.blur();" />3
<input name="chkSon" type="checkbox" onclick="ChkSonClick(this)"
value="4" onfocus="this.blur();" />4
js全选
最新推荐文章于 2025-08-01 15:23:39 发布