js 树的操作

  function get_check_data()
     
{  
     
     
try
        
{
        var Url
=window.location .href+"";
       var flag_star
=Url.indexOf('flag=');
       var flag_end
=Url.indexOf('&check')
        var temp
=Url.substring(flag_star+5,flag_end);
         
         var  check_star
=Url.indexOf('check=');
         var  check_end
=Url.indexOf('&star')  ;
         var check_temp
=Url.substring(check_star+6,check_end);
             
            var  type
=check_temp.split('|')
            var  type_data
="";
            
for ( i=0;i<type.length;i++)
           
{
              type_data
=type_data+type[i];
             }

             
           
          
            var flag
=parseInt(temp)-1
          left_TreeView1.getTreeNode(flag
+'').setAttribute('Expanded',true);
          
       
          
           
          
// if (temp=='0')
           
               var NodeArray
=new Array();
             NodeArray
=left_TreeView1.getTreeNode(flag+'').getChildren();
             
             
if (check_temp=='0')
             
{
               left_TreeView1.getTreeNode(flag
+'').setAttribute('Checked',true);
               
for (n=0;n<NodeArray.length ;n++)
                    
{
                      left_TreeView1.getTreeNode(flag
+'.'+n).setAttribute('Checked',true);
                    }

              
             }

             
else
             
{
             
for (j=0 ;j<NodeArray.length ;j++)
             
{   
                    
for (k=0;k<type.length;k++)
                    
{
                     
               
if (left_TreeView1.getTreeNode(flag+'.'+j).getAttribute('NodeData')==type[k])
                  
                left_TreeView1.getTreeNode(flag
+'.'+j).setAttribute('Checked',true);
                    }

             }

           
          }

          
    
// window.alert (temp); 
    
// window.alert (check_temp);
        
        }

       
        
catch(e)
        
{
        
        }

         
     }

posted on 2005-04-13 10:43  gwazy  阅读(587)  评论(0编辑  收藏  举报

导航