首页 > 编程 > JavaScript > 正文

ASP.NET2.0下利用javascript实现TreeView中的checkbox全选

2019-11-18 17:05:43
字体:
来源:转载
供稿:网友

<td><input id="chkall" type="checkbox" onclick="chkAll();" />全选/取消</td>
 1 <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>

http://xh3.VEVb.com/archive/2006/07/20/456077.html


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表