<input id="Chk_All" onclick="CheckAll()" type="checkbox" />
<input name=\"al\" id=\"" + item["WH"].ToString() + "\" acttype=\"info\" type=\"checkbox\" />
全选、反选
function CheckAll() {
if ($("#Chk_All").attr("checked")) {
//全选
$("input[type='checkbox'][acttype='info']").attr("checked", "checked");
} else {
/取消全选
$("input[type='checkbox'][acttype='info']").attr("checked", false);
}
}
获取checkbox值:
方法一:
//获取全部
function SelAllInfoId() {
var json = ""; $("input[type='checkbox'][acttype='info'][checked='checked']").each(function (index) {
json = json + $(this).attr("id") + ";";
});
}
方法二
//获取全部
function SelAllInfoId() {
var json = "";
if (json == "") {
$('input[name="al"]:checked').each(function () {
json = json + $(this).attr("id") + ";";
});
}