我有一个列出员工的页面。在列表的左侧,我可以选择复选框。因此,我在header.When中也有了全选复选框,我点击全选复选框,它将选中下面的所有复选框。但是我让javascript在onclick事件中选中了向下的复选框,而不是全部选中了复选框。当我使用select all选择所有的复选框时,下面的checkbox onclik事件不会被调用。我还验证了onchange,onselect事件。
<display:column style="width:2%"
title="<input type='checkbox' id='allCheck' name='allCheck' value='propertyConcernId'
onclick='checkAll(this);'/>">
<s:checkbox name="propertyConcernId" fieldValue="%{prtyCrnId}" tabindex="7"
id="check_%{#attr.row.propertyId}"
onclick="verifyCheckAll(this);assignValue('select_%{#attr.row.propertyId}','check_%{#attr.row.propertyId}')" />
</display:column>怎么做呢?帮帮忙。
verifyCheckAll = function(childCheckBox) {
$(document).ready(function() {
var isAllChecked = true;
$("input:checkbox[name="+childCheckBox.name+"]").each(function() {
if (this.checked == false) {
isAllChecked = false;
}
});
$("input[name=allCheck]").attr('checked', isAllChecked);
isRecSelected(childCheckBox.name);
});
} 这是我用来选中子复选框的脚本
发布于 2010-09-23 17:09:37
我通过以下方式实现了这一点:
callChildClick = function(parentChkBox) {
var checked_status = parentChkBox.checked;
$(document).ready(function() {
$("input:checkbox[name="+parentChkBox.value+"]").each(function() {
this.click();
});
});
isRecSelected(parentChkBox.value);
}发布于 2010-09-23 15:52:59
在checkAll()函数中,转到您拥有的每个复选框,并为每个propertyConcernId字段调用onClick事件中的内容。
https://stackoverflow.com/questions/3776231
复制相似问题