zoukankan      html  css  js  c++  java
  • 全选

    <body>
    <input type="checkbox" id="ckAll" />全选<br />
    <input type="checkbox" name="sub" />1<br />
    <input type="checkbox" name="sub"/>2<br />
    <input type="checkbox" name="sub"/>3<br />
    <input type="checkbox" name="sub"/>4<br />
    <script type="text/javascript">
    $(function(){
    $('#ckAll').click(function(){
    $('input[name=sub]').prop('checked',this.checked);
    })
    var len=$('input[name=sub]').length;
    $('input[name=sub]').click(function(){
    var lens=$('input[name=sub]:checked').length;
    if(lens==len){
    $('#ckAll').prop('checked',true);
    }else{
    $('#ckAll').prop('checked',false);
    }
    })
    })
    
    </script>
    
    <script>
    /*
    $(function(){
    $("#ckAll").click(function() {
    $("input[name='sub']").prop("checked",this.checked))};
    $("input[name='sub']").click(function() {
    var $subs = $("input[name='sub']");
    $("#ckAll").prop("checked" , $subs.length == $subs.filter(":checked").length ? true :false);
    });    
    })
    */
    </script>    
    </body>
    View Code
  • 相关阅读:
    HttpServletResponse对象
    FastJSON 简介及其Map/JSON/String 互转(转载)
    commons-lang3-3.4类库
    HttpClient相关
    JSON.parse()方法 (转载)
    textview用法--推荐
    每日总结
    百度网盘
    每日总结
    每日总结
  • 原文地址:https://www.cnblogs.com/wangmeiMeo/p/7122175.html
Copyright © 2011-2022 走看看