function selectedAll(allselect, obj) { $("#"+obj.id+" input:checkbox").each(function () { if (allselect.checked) $(this).attr("checked", true); else { $(this).attr("checked", false); } }); }
调用
<input id="allCheck" onclick="selectedAll(this, document.getElementById(‘cbl_cg‘))" type="checkbox" name="allCheck" />全选/反选