function CheckAll()
{
for(var i = 0; i < document.form1.commentid.length; i++)
{
if(document.form1.commentid[i].checked == false)
document.form1.commentid[i].checked = true;
else
document.form1.commentid[i].checked = false;
}
}
<input type="button" name="checkAll" value="选中本页所有项" οnclick="CheckAll();" class="inputbut
1.放在Repeater控件中使用:
<asp:Repeater ID="rptMsgList" runat="server">
<ItemTemplate>
"/><dt class="dt">
<input type="checkbox" name="commentid" id="commentid" value="<%#Eval("id") %>" />
<img src="../images/pic/icon.jpg" alt="" />
</dt>
<dt class="dd">
<%#NT.Common.NTString.toHtml(Eval("msgcontent").ToString())%>
</dt>
</ItemTemplate>
</asp:Repeater>
2.后台cs获取:
protected void btnPass_Click(object sender, EventArgs e)
{
bool brt = false;
string[] commentids = Request["commentid"].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string id in commentids)
{
brt=comment.CommentCheck(Convert.ToInt32(id));
}
DisPlayCommentList();
}
js之Repeater-实现全选
最新推荐文章于 2019-02-13 15:34:01 发布