zoukankan      html  css  js  c++  java
  • input checkbox 全选

     <!DOCTYPE Html>  

     <html>  
     
        <head>  

             <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>  

             <script type="text/javascript">  
     
                 function selectAll(checkbox) {  
     
                     $('input[type=checkbox]').attr('checked', $(checkbox).attr('checked'));  
     
                 }  

             </script>  
     
         </head>  

         <body>  
     
             <input type="checkbox" onclick="selectAll(this);" />全选<br/>  
     
             <input type="checkbox"  /><br/>  
     
             <input type="checkbox"  /><br/>  
     
             <input type="checkbox"  /><br/>  
     
             <input type="checkbox"  /><br/>  
     
             <input type="checkbox"  /><br/>  
     
             <input type="checkbox"  /><br/>  
     

     
         </body>  
     
     </html

     
    //全选
    04 function select_all(){
    05     $("input[name='id']").attr("checked", true);
    06 }
    07   
    08 //全不选
    09 function unselect_all(){
    10     $("input[name='id']").attr("checked", false); 
    11 }
    12   
    13 //反向选择
    14 function select_other(){
    15     jQuery.each($("input[name='id']"), function(i, n){
    16     n.checked = !n.checked;
    17     }); 
    18 }
     
  • 相关阅读:
    Git Merge Request
    Hazelcast Hazelcast介绍与使用
    Git 修改name/author信息
    HDU 2553 N皇后问题(DFS)
    HDU 1070 Milk(水题)
    HDU 2616 Kill the monster(简单DFS)
    HDU 1426 Sudoku Killer(BFS)
    HDU 2216 Game III(BFS)
    URAL 1001 Reverse Root(水题)
    URAL 1902 NeoVenice(水题)
  • 原文地址:https://www.cnblogs.com/sprine/p/4682173.html
Copyright © 2011-2022 走看看