zoukankan      html  css  js  c++  java
  • JS 控制 repeater 中的 checkbox 全选/全不选

    qiyu注:测试可用,需要注意的是var theform=document.Form1 这个“Form1”要改成实际的名字。

    全选/反选js

    function SelectAll() { var theform=document.Form1; if(theform.Checkbox1.checked) { for(var i=0;i < theform.elements.length;i++) { if (theform.elements[i].type == 'checkbox') { var e = theform.elements[i]; e.checked = true; } } } else { for(var i=0;i < theform.elements.length;i++) { if (theform.elements[i].type == 'checkbox') { var e = theform.elements[i]; e.checked = false; } } } }

    操作按钮

    <input type=checkbox id="Checkbox1" name=Checkbox1 nclick="SelectAll();"/>

    选择对象

    <input type=checkbox id=ckb name=ckb value=runat=server/>

    遍历选中按钮

    string arrid="";
       string a="";
       foreach   (RepeaterItem   item   in   AdminList.Items)
       {
        HtmlInputCheckBox   chkbox1=(HtmlInputCheckBox)item.FindControl("ckb");
        if   (chkbox1.Checked==true)
        {
         arrid+=chkbox1.Value+",";
         a+=chkbox1.Value;
        }
       }
       if(a.Length==0)
       {
        Response.Write("<script>alert('请选择短信息');window.location.href='noteManage.aspx?g=notelist';</script>");
        return;
       }
       arrid=arrid.Substring(0,arrid.Length-1);
       string[] id=arrid.Split(',');
       if(id.Length>=1)
       {
        for(int i=0;i<id.Length;i++)
        {
         DB.Note_Delete(id[i].Trim(),2);
       
        }
        Response.Write("<script>alert('短信息删除成功');window.location.href='noteManage.aspx?g=notelist';</script>");
       }

  • 相关阅读:
    git 入门操作
    ubuntu apc 安装
    vps mysql自动关闭
    xdebug安装
    C#获取IP和主机名
    C#在类中用调用Form的方法
    luogu3181 [HAOI2016]找相同字符
    luogu6139 【模板】广义后缀自动机(广义SAM)
    广义后缀自动机小结
    Codeforces Round #620 (Div. 2) 题解
  • 原文地址:https://www.cnblogs.com/infozr/p/2245760.html
Copyright © 2011-2022 走看看