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>");
       }

  • 相关阅读:
    hadoop:WordCount问题总结
    .mata. _root_ (转)
    Hbase笔记:批量导入
    Hbase笔记4 java操作Hbase
    wget
    中国大陆开源镜像站汇总
    全键盘操作Windows
    linux下实用命令
    /dev/null和/dev/zero的区别
    Windows xp下安装sql server2005所碰到的一些问题及解决方法
  • 原文地址:https://www.cnblogs.com/infozr/p/2245760.html
Copyright © 2011-2022 走看看