代码
 1 <head>
 2     <title>JQuery实现全选</title>
 3     <script language="javascript" type="text/javascript" src="file:///G:/programming/js/jQuery1.3.2/jquery-1.3.2.min.js"></script>
 4 <script type="text/javascript">
 5     function selectall()
 6     {
 7         if($("#selectall").attr("checked")==true)
 8         {
 9             $(":checkbox").each(function(){$(this).attr("checked",true);})
10         }
11         else
12         {
13             $(":checkbox").each(function(){$(this).attr("checked",false);})   
14         }
15     }
16 </script>
17 </head>
18 <body>
19 <input type='checkbox' />UserA
20 <input type='checkbox' />UserB
21 <input type='checkbox' />UserC
22 <input type="checkbox" id="selectall" onclick="selectall()" />全选
23 </body>
24 </html>
25 

代码比较简单,不会的可以查一下jquery的API,很容易明白的!

相关文章:

  • 2022-01-10
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2022-02-27
  • 2022-12-23
  • 2021-06-08
猜你喜欢
  • 2021-12-29
  • 2021-09-10
  • 2022-01-15
  • 2021-11-28
  • 2021-12-20
相关资源
相似解决方案