• js实现复选框(单选,全选)


    <head>

    <body>

    <div class="img-list w760 bor-top margin-t10 line-h35" id="container">
    <ul class="bgColor w760 align-c">
    <li class="w48">
    <input type="checkbox" name="checkall" id="checkall" /></li>
    <li class="w48"></li>
    <li class="w120"><b>昵称</b></li>
    <li class="w170"><b>性别</b></li>
    <li class="w170 align-c"><b>最后发言</b></li>
    <li class="w100"></li>
    </ul>
    <asp:Repeater ID="Rpcirclemember" runat="server">
    <AlternatingItemTemplate>
    <ul class="w760 align-c bgColor">
    <li class="w48 margin-t10" item="">
    <input type="checkbox" name="circlecheck" value="<%#Eval("UserId")%>" realname="<%#Eval("UserName")%>" /></li>
    <li class="w48">
    <img src="<%#Eval("HeadUrl")==null ? "/images/default-img/default-user.jpg" : Eval("HeadUrl") %>"
    alt="成员头像" class="img-bor" /></li>
    <li class="w120 margin-t10 colorBlue">
    <%#string.IsNullOrEmpty(Eval("UserName").ToString()) ? "匿名" :Eval("UserName")%></li>
    <li class="w170 margin-t10">
    <%#string.IsNullOrEmpty(GetSex(Eval("Sex").ToString()))? "未填写" : GetSex((Eval("Sex").ToString()))%></li>
    <li class="w170 align-c margin-t10">
    <%#Eval("LastSpeakDate")%></li>
    <li class="w100 colorRed margin-t10">
    <%#(bool)Eval("IsSilence") == true ? "<em class='icon-ban' title='禁言'></em>" : ""%>
    </li>
    </ul>
    </AlternatingItemTemplate>
    <ItemTemplate>
    <ul class="w760 align-c">
    <li class="w48 margin-t10" item="">
    <input type="checkbox" name="circlecheck" value="<%#Eval("UserId")%>" realname="<%#Eval("UserName")%>" /></li>
    <li class="w48">
    <img src="<%#Eval("HeadUrl")==null ? "/images/default-img/default-doctor.jpg" : Eval("HeadUrl") %>"
    alt="成员头像" class="img-bor" /></li>
    <li class="w120 margin-t10 colorBlue">
    <%#string.IsNullOrEmpty(Eval("UserName").ToString()) ? "匿名" : Eval("UserName")%></li>
    <li class="w170 margin-t10">
    <%#string.IsNullOrEmpty(GetSex(Eval("Sex").ToString()))? "未填写" : GetSex(Eval("Sex").ToString())%></li>
    <li class="w170 align-c margin-t10">
    <%#Eval("LastSpeakDate")%></li>
    <li class="w100 colorRed margin-t10">
    <%#(bool)Eval("IsSilence")==true ? "<em class='icon-ban' title='禁言'></em>" : ""%>
    </li>
    </ul>
    </ItemTemplate>
    </asp:Repeater>
    </div>

    </body>

    </head>

    $("#checkall").click(function(){

      var flag=$("#checkall").attr("checked");

      if(flag){

      $("input[name=circlecheck]").each(function(){

      $(this).attr("checked",flag);

      });

      else {

      $("input[name=circlecheck]").each(function(){

      $(this).attr("checked",false);

      });

        }

      }

      });

       $("input[name=circlecheck]").each(function(){

      $(this).click(fucntion(){

      if($("input[name=circlecheck] :checked").length==$("input[name=circlecheck]").length){

      $("#checkall").attr("checked",true);

         }

      else{

        $("#checkall").removeAttr("checked");

        }

      });

    });

  • 相关阅读:
    Spring优雅关闭之:ShutDownHook
    RocketMQ一直打印RocketmqRemoting closeChannel: close the connection to remote address[] result: true
    MVC中使用内建的HTML辅助方法产生表单元素提交表单与button按钮事件的陷阱
    js代码生成form,解决mvc的url参数过长问题
    jQuery中关于height,innerWidth与outerWidth的区别
    Chrome和Firefox浏览器执行new Date() 函数传参数得到不同结果的陷阱
    SQL时间段查询、分页、in字符串正则拆分
    JAVA初始化文件代码
    Base64加密URL、解密URL
    Spring XML model validation
  • 原文地址:https://www.cnblogs.com/zhengrunqiang/p/2479431.html
Copyright © 2020-2023  润新知