导航首页 » 网站优化

织梦实现多选框全选/取消方法

2023/03/11 12:23    魔司收录网    已浏览151次

织梦实现多选框全选/取消实例代码:        
01 <!DOCTYPE Html>
02  
03         <html>
04  
05             <head>
06  
07                 <script type="text/javascript" src=jquery-1.8.3.min.js"></script>
08  
09                 <script type="text/javascript">
10  
11                     function selectAll(checkbox) {
12  
13                         $('input[type=checkbox]').prop('checked', $(checkbox).prop('checked'));
14  
15                     }
16  
17                 </script>
18  
19             </head>
20  
21             <body>
22  
23                 <input type="checkbox" onclick="selectAll(this);" />全选<br/>
24  
25                 <input type="checkbox"  /><br/>
26  
27                 <input type="checkbox"  /><br/>
28  
29                 <input type="checkbox"  /><br/>
30  
31                 <input type="checkbox"  /><br/>
32  
33                 <input type="checkbox"  /><br/>
34  
35                 <input type="checkbox"  /><br/>
36  
37                 ……
38  
39             </body>
40  
41         </html>