<script type="text/javascript">
2 function chkAll()
3 {
4 //debugger;
5 var chkall= document.all["chkall"];
6 var chkother= document.getElementsByTagName("input");
7 for (var i=0;i<chkother.length;i++)
8 {
9 if( chkother[i].type=='checkbox')
10 {
11 if(chkother[i].id.indexOf('TreeView1')>-1)
12 {
13 if(chkall.checked==true)
14 {
15 chkother[i].checked=true;
16 }
17 else
18 {
19 chkother[i].checked=false;
20 }
21 }
22 }
23 }
24 }
25 </script>
2 function chkAll()
3 {
4 //debugger;
5 var chkall= document.all["chkall"];
6 var chkother= document.getElementsByTagName("input");
7 for (var i=0;i<chkother.length;i++)
8 {
9 if( chkother[i].type=='checkbox')
10 {
11 if(chkother[i].id.indexOf('TreeView1')>-1)
12 {
13 if(chkall.checked==true)
14 {
15 chkother[i].checked=true;
16 }
17 else
18 {
19 chkother[i].checked=false;
20 }
21 }
22 }
23 }
24 }
25 </script>

本文介绍了一种使用JavaScript实现全选与批量选择复选框的方法。通过操作DOM元素,该脚本能够根据全选按钮的状态同步更新页面上特定ID前缀的复选框状态。适用于需要进行批量操作的Web应用程序。
4002

被折叠的 条评论
为什么被折叠?



