script type="text/javascript">
function SelectAll(parentChk, ChildId, bigControlID) {
var oElements = document.getElementsByTagName("INPUT");
var bIsChecked = parentChk.checked;
for (i = 0; i oElements.length; i++) {
if (IsCheckBox(oElements[i]) IsMatch(oElements[i].id, ChildId, bigControlID)) {
oElements[i].checked = bIsChecked;
}
}
}
function IsMatch(id, ChildId, controlID) {
var sPattern = '^' + controlID + '_+.*' + ChildId + '$';
var oRegExp = new RegExp(sPattern);
if (oRegExp.exec(id))
return true;
else
return false;
}
function IsCheckBox(chk) {
if (chk.type == 'checkbox') return true;
else return false;
}
/script>
asp:Repeater ID="Repeater_xx" runat="server">
HeaderTemplate>
table>
tr>
th>选项/th>
th>数据/th>
/tr>
/HeaderTemplate>
ItemTemplate>
tr>
td>
asp:CheckBox ID="CheckBox_ID" runat="server" Checked="false" />
/td>
td>
asp:Label runat="server" ID="Label_ID" Text='%#Eval("Label_ID")%>'>/asp:Label>
/td>
tr>
/ItemTemplate>
FooterTemplate>
/table>
/FooterTemplate>
/asp:Repeater>
asp:CheckBox runat="server" ID="CheckBoxCz" Text="全选/反选" onclick='SelectAll(this,"CheckBox_ID","Repeater_xx")'/>
input class="anniu" id="input_gs" type="submit" runat="server" onserverclick="Gssubmit_Click" value="操作" />