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 }
     
  • 相关阅读:
    AT2667-[AGC017D]Game on Tree【SG函数】
    P5163-WD与地图【tarjan,整体二分,线段树合并】
    P4258-[WC2016]挑战NPC【带花树】
    P7099-[yLOI2020]灼【数学期望,结论】
    P5056-[模板]插头dp
    P2012-拯救世界2【EGF】
    [CSP校内集训]替换游戏(tarjan+离散化)
    4.24作业
    【题解】考分鄙视
    【题解】鱼塘钓鱼
  • 原文地址:https://www.cnblogs.com/sprine/p/4682173.html
Copyright © 2011-2022 走看看