• jquery中实现全选按钮


    <html>
      <head>
      <script type='text/javascript' src='js/jquery-1.5.1.js'></script>
      <script type='text/javascript'>
        $(document).ready(function(){
       $('#handle').click(function(){
         if($(this).attr('checked')==true){
       $('.toggle').attr('checked','true');
       }
      else{
       $('.toggle').removeAttr('checked');
       }
       });
       $('.toggle').click(function(){
         if($('.toggle:checked').length==$('.toggle').length){
         $('#handle').attr('checked','true');
         }
      else{
        $('#handle').removeAttr('checked');
        }
      });
     });
      </script> 
      <style type='text/css'>
      ul{
         background-color:#ccc;
      list-style:none;
      margin 20px auto;
      }
      li{
        padding:10px;
     }
      </style>
      </head>
      <body>
        <ul>
       <li>
        <input type='checkbox' id='handle'>
           <label for='handle'>
          <strong> Toggle ALL</strong></label>
      </li>
       <li>
         <input type='checkbox' class='toggle'>
         <label> aaaaaaa</label>
         </li>
       <li>
         <input type='checkbox' class='toggle'>
         <label> bbbbbbb</label>
         </li>
       <li>
         <input type='checkbox' class='toggle'>
         <label> cccccccc</label>
         </li>
       <li>
         <input type='checkbox' class='toggle'>
         <label> ddddddd</label>
         </li>
     </ul>
      </body>
     </html>

  • 相关阅读:
    mongo连接拒绝10061原因
    python爬取CNKI的期刊
    C语言socket编程
    Linux c time模块函数库
    linux下python3调用c代码或者python3调用c++代码
    stl综合
    linux c调用 mysql代码
    debian系列下c++调用mysql, linux下面安装mysql.h文件
    c++ linux socket编程 c++网络编程
    比较均值分析思路
  • 原文地址:https://www.cnblogs.com/javawebsoa/p/3150351.html
Copyright © 2020-2023  润新知