zoukankan      html  css  js  c++  java
  • js全选功能

            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="选中本页所有项" onclick="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="" />
                                    
    <%--<span class="msgtitle">#<%# _rsCount + 1 - (Container.ItemIndex + 1 + _PageSize * (page - 1)) %>&nbsp;</span>--%>
    </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();
        }
  • 相关阅读:
    idea jvm 优化
    MYSQL
    mysql
    window.print() 去掉页眉页脚及打印链接【转载】
    eclipse maven插件问题:error occurred while automatically activating bundle org.eclipse.m2e.core.ui (525)
    数据挖掘的数据集资源 --转载
    Python分析《武林外传》 -----转载
    难题
    cookie格式化
    python 中变量的命名规范
  • 原文地址:https://www.cnblogs.com/cancer_xu/p/1609741.html
Copyright © 2011-2022 走看看