/// <summary>
/// 点击行选中或者取消CheckBox
/// </summary>
function Set_CheckBoxCheckTr() {
$("table.Qub_tb_List tr").slice(1).each(function () {//slice(1)表示排除第一行
var p = this;
$(this).children().slice(2).click(function () {//slice(2)表示第二行
$($(p).children()[1]).children().each(function () {//$(p).children()[1]表示第二列
if (this.type == "checkbox") {
if (!this.checked) this.checked = true;
else this.checked = false;
}
});
});
});
}
如下图所示:

本文介绍了一种通过点击表格中的行来切换该行内Checkbox选中状态的方法。使用jQuery实现,点击任意一行时,会切换该行下第二个单元格内Checkbox的状态。


299

被折叠的 条评论
为什么被折叠?



