ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【xh&hhh】ASP.NET2.0下利用javascript实现TreeView中的checkbox全选!

【xh&hhh】ASP.NET2.0下利用javascript实现TreeView中的checkbox全选!

原创 Linux操作系统 作者:iDotNetSpace 时间:2008-06-03 09:58:20 0 删除 编辑
<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>

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12639172/viewspace-330959/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-01-04

  • 博文量
    2376
  • 访问量
    5766066