我的思路
<div> 树的名字 </div>
<div> 子 </div>子里面再套树
但是我的树在客户端加载确比较慢.思路不对还是程序问题.请各位高手,前辈节点注意的问题.
下面是我的加载item的函数
function additem(pid,id,text,realpath,filetype)
{
   var table="";
   var divnum= eval( document.all(pid).divnum ) +1;
   var childindex =document.all(pid+"r").childNodes.length+2;
 
table=table+"<table border=\""+border+"\" cellpadding=\"0\" cellspacing=\"0\"  >";
    table=table+"<tr  onclick=\"showchild('"+id+"','"+text+"')\"  style='cursor:hand;'   >";
table=table+"<td>";
    
// 填写 l , b
var tabletempB="";
var pidtemp=  pid ;


table=table+"<img src=\""+ imgpath +"/tree_B.gif\" width='19' height='20' >"; for (var i=0;i<divnum ;i++ )
{
                //读取父ID的父ID
      var childindex2=0 ;
  try
  {
   childindex2 =( document.all(pidtemp).childindex);
  }
  catch (e)
  {
  }
    pidtemp=document.all(pidtemp).pid;
              
  
              if (childindex2==0)
              {      tabletempB="<img src=\""+ imgpath +"/tree_B.gif\" width='19' height='20' alt='"+pidtemp+"|"+ childindex2 +"' >" + tabletempB;
              }else{
                      // 如果 pidtemp 所在的节点是最后一个 选择 tree_B.gif
  if (  document.all(pidtemp+"r").childNodes.length == childindex2  )
  {
     tabletempB="<img src=\""+ imgpath +"/tree_B.gif\" width='19' height='20' alt='"+pidtemp+"|"+ childindex2 +"' >" + tabletempB;
  }else{      tabletempB="<img src=\""+ imgpath +"/tree_I.gif\" width='19' height='20' alt='"+pidtemp+"|"+ childindex2 +"|"+document.all(pidtemp+"r").childNodes.length+"' >" + tabletempB;
  }
  }  
  }
    table=table + tabletempB;

//展开时自动判断
table=table+"<img src=\""+ imgpath +"/tree_T.gif\" width='19' height='20' id=\"imga"+id+"\" >";
    
//如果是文件夹显示文件夹,如果是文件显示文件,这里没有判断
    if (filetype==0)
    {       table=table+"<img src=\"" + imgpath + "/" +"clsfld.gif"+"\" id=\"imgb"+id+"\"  >";
    }else{
    table=table+"<img src=\"" + imgpath + "/" +"link.gif"+"\" id=\"imgb"+id+"\"  >";
}    table=table+"</td><td  id='t"+id+"' onclick=\"javascript:this.bgColor='blue';  if(focobj!=''){ eval(focobj).bgColor='#ffffff'; }  focobj=this.id;     \">"; table=table+realpath  ;
table=table+"</td>";
table=table+"</tr>";
table=table+"</table>"; try
{
document.all("imga"+pid).src=imgpath+"/tree_Tplus.gif";
}
catch (e)
{
}
//下一层菜单
 
var div = document.createElement('div');
div.id=id;
div.pid=pid;
div.divnum= divnum ;
    div.childindex= childindex;
div.filetype=filetype
div.innerHTML=table; // 表格内容
    document.all(pid+"r").appendChild (div);

    var divr =document.createElement('div');
divr.id=id+"r";
    divr.style.display='none';
document.all(pid+"r").appendChild (divr);    
    //显示父
document.all(pid+"r").style.display='';
document.all("imga"+pid).src=imgpath+'/tree_Tminus.gif';
document.all("imgb"+pid).src=imgpath+'/openfld.gif';
   
}