zoukankan      html  css  js  c++  java
  • jquery全选的选中和取消选中

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title> New Document </title>
    <meta name="Generator" content="EditPlus">
    <meta name="Author" content="">
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    </head>
    <script type="text/javascript" src="http://libs.baidu.com/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript">

    /**全选*/
    $("#checkAll").click(function(){
      if($("#checkAll").is(":checked")){
        $("input:checkbox:not('#checkAll')").each(function(){
          $(this).attr("checked",true);
          $(this).prop("checked",true);
        });
      }else{
        $("input:checkbox:not('#checkAll')").each(function(){
          $(this).attr("checked",false);
          $(this).prop("checked",false);
        });
      }
    });


    </script>
    <body>
    <div>
    <input type="checkbox" name="checkAll" id="checkAll" value="0" id="checkAll">全选
    <input type="checkbox" name="checkbox"  id="checkbox1"  value="1"/>
    <input type="checkbox" name="checkbox"  id="checkbox2"  value="2"/>
    <input type="checkbox" name="checkbox"  id="checkbox3"  value="3"/>
    <input type="checkbox" name="checkbox"  id="checkbox4"   value="4"/>
    <input type="checkbox" name="checkbox"  id="checkbox5"   value="5"/>
    <input type="button" id="test" onclick="submit();" value="submit"/>
    </div>
    </body>
    </html>

     

  • 相关阅读:
    BlockUI常见问题
    AssemblyInfo文件
    asp.net 如何让虚拟目录里面的webconfig不继承主目录config(转)
    jquery Ajax示例
    jQuery Ajax 实例 全解析 (转)
    如何在ASP.NET服务器控件库中嵌入JavaScript脚本文件(转)
    如何使用ASP.NET2.0的“嵌入的资源”(转)
    BlockUI对话框
    Jquery ajax参数设置
    What's production quality
  • 原文地址:https://www.cnblogs.com/littleapple/p/9760646.html
Copyright © 2011-2022 走看看