js 实现子树选中时父目录全被选中

  
 function change()
         {
            
   
var clickedNodeIndex=TreeView1.clickedNodeIndex;
  
var choose;
       
if (TreeView1.getTreeNode(clickedNodeIndex).getAttribute('Checked'))
          { 
            choose
=true;
           }
          
else
          { 
             choose
=false;
           }

       
        
       
         
         
var temp=new Array();
             temp
=clickedNodeIndex
             temp
=temp+"";
             
var bbb=temp.split(".");
            
var  check='';
          
for ( i=0;i<bbb.length;i++
          {
            check
=check+bbb[i];  
              
            
// alert(check) ;
              TreeView1.getTreeNode(check).setAttribute('Checked',choose);
               
              check
=check+"." ;
             
          }
         }


this.TreeView1 .Attributes.Add ("oncheck","change()");

树在客户端代码始如下
 1  
      1.1 
       1.2
           1.2.1
 

posted on 2005-06-13 15:54  gwazy  阅读(1008)  评论(0编辑  收藏  举报

导航