HTML:
<input type="checkbox" onclick="boxOnclick(this,'some1')">全选一
<input type="checkbox" onclick="boxOnclick(this,'some2')">全选二
<input type="checkbox" onclick="boxOnclick(this,'some3')">全选三
<input type="checkbox" class="some1">全选一的子集
<input type="checkbox" class="some2">全选二的子集
<input type="checkbox" class="some3">全选三的子集
JS:
function boxOnclick(obj, someNum) {
if (obj.checked) {
$("." + someNum).each(function () {
this.checked = true;
});
} else {
$("." + someNum).each(function () {
this.checked = false;
});
}
}