我在页面上有一个“全选”复选框,它将取消选择并选中以下复选框。
<div class="field">
<div class="SelectAllCheckBox">
<input type="checkbox" id="SelectAllCheckBox" />
<label for="SelectAllCheckBox">Select All</label>
</div>
</div>
<div id="TargetsPanel" class="panel" style="display: block;">
<div class="body stack-calc">
<table id="TargetsTable" class="tm-list" cellspacing="0">
<colgroup>
<col width="20px">
<col width="20%">
<col>
</colgroup>
<thead>
<tr>
<th></th>
<th> Language </th>
<th> Workflow </th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td>
<span class="LanguageName">Arabic</span>
<ul class="Publications">
<li>
<img alt="" src="/test/tt.png">
<input type="checkbox" id="tcm:0-235-1" name="tcm:0-235-1" checked="checked">
<label for="tcm:0-235-1">Test Arabic</label>
</li>
</ul>
</td>
<td><select name="_1041" disabled=""><option value="1650">Test</option></select></td>
</tr>
<tr>
<td></td>
<td>
<span class="LanguageName">Test Chinese (HongKong)</span>
<ul class="Publications">
<li>
<img alt="" src="/test/mm.png">
<input type="checkbox" id="tcm:0-368-1" name="tcm:0-368-1" checked="checked">
<label for="tcm:0-368-1">Test (Traditional Chinese)</label>
</li>
</ul>
</td>
<td><select name="_1116" disabled=""><option value="1650">Test2</option></select></td>
</tr>
...
...
...//It goes on for other checkboxes.
...
...
</tbody>
</table>
</div>
</div>
现在我希望在所有复选框下方的“SelectAllCheckBox”复选框上具有选择和取消选择功能。进行映射的复选框没有什么共同点,除了它们是复选框,我希望这些复选框只有其他复选框超出范围。
<input type="checkbox" id="tcm:0-235-1" name="tcm:0-235-1" checked="checked">
<input type="checkbox" id="tcm:0-368-1" name="tcm:0-368-1" checked="checked">
....
....
....
谢谢
编辑:
c.SelectAllCheckBox = $("#SelectAllCheckBox"); //I am initializing the existing checkbox id
$evt.addEventHandler(c.SelectAllCheckBox, "click", this.getDelegate(this._onSelectAllCheckBoxClick)); //Here I am adding the event listner
TranslationJob.prototype._onSelectAllCheckBoxClick = function TranslationJob$_onSelectAllCheckBoxClick(headDoc, items)
{
var p = this.properties;
var c = p.controls;
//Here I want code which will deselect and select the checkboxes
};
必需:
该功能应该在选择 master 时工作,所有子应被选中,一旦取消选择 master,所有子应被取消选择,并且如果任何子复选框被取消选择,则 master 应被取消选择,如果所有子被选中 master 应相同被自动选中