CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  JavaScript

树状导航菜单的实现

楼主uncarman()2002-06-11 15:00:34 在 Web 开发 / JavaScript 提问

谁能够给我一个JS编写的树状导航菜单,类似WinForm中的TreeView控件,并且图片和文字都可以更换及添加链接,望高手指点 问题点数:80、回复次数:4Top

1 楼seabell(百合心)回复于 2002-06-11 15:24:34 得分 20

有关树的东东以前问过很多  
  我这里有一个,你的email?Top

2 楼huguguhu()回复于 2002-06-11 19:06:23 得分 0

我也要一份  
  lizhanxin0325@yahoo.com.cnTop

3 楼crazylily(lily)回复于 2002-06-11 23:59:18 得分 40

<SCRIPT   language=JavaScript1.2>  
  scores   =   new   Array(20);  
  var   numTotal=0;  
  NS4   =   (document.layers)   ?   1   :   0;  
  IE4   =   (document.all)   ?   1   :   0;  
  ver4   =   (NS4   ||   IE4)   ?   1   :   0;  
   
  if   (ver4)   {  
          with   (document)   {  
                  write("<STYLE   TYPE='text/css'>");  
                  if   (NS4)   {  
                          write(".parent   {position:absolute;   visibility:visible}");  
                          write(".child   {position:absolute;   visibility:visible}");  
                          write(".regular   {position:absolute;   visibility:visible}")  
                  }  
                  else   {  
                          write(".child   {display:none}")  
                  }  
                  write("</STYLE>");  
          }  
  }  
   
  function   getIndex(el)   {  
          ind   =   null;  
          for   (i=0;   i<document.layers.length;   i++)   {  
                  whichEl   =   document.layers[i];  
                  if   (whichEl.id   ==   el)   {  
                          ind   =   i;  
                          break;  
                  }  
          }  
          return   ind;  
  }  
   
  function   arrange()   {  
          nextY   =   document.layers[firstInd].pageY   +document.layers[firstInd].document.height;  
          for   (i=firstInd+1;   i<document.layers.length;   i++)   {  
                  whichEl   =   document.layers[i];  
                  if   (whichEl.visibility   !=   "hide")   {  
                          whichEl.pageY   =   nextY;  
                          nextY   +=   whichEl.document.height;  
                  }  
          }  
  }  
   
  function   initIt(){  
          if   (!ver4)   return;  
          if   (NS4)   {  
                  for   (i=0;   i<document.layers.length;   i++)   {  
                          whichEl   =   document.layers[i];  
                          if   (whichEl.id.indexOf("Child")   !=   -1)   whichEl.visibility   =   "hide";  
                }  
                  arrange();  
          }  
          else   {  
                  divColl   =   document.all.tags("DIV");  
                  for   (i=0;   i<divColl.length;   i++)   {  
                          whichEl   =   divColl(i);  
                          if   (whichEl.className   ==   "child")   whichEl.style.display   =   "none";  
                  }  
          }  
  }  
   
  function   expandIt(el)   {  
  if   (!ver4)   return;  
          if   (IE4)   {  
                  whichEl1   =   eval(el   +   "Child");  
  for(i=1;i<=numTotal;i++){  
  whichEl   =   eval(scores[i]   +   "Child");  
  if(whichEl!=whichEl1)   {  
  whichEl.style.display   =   "none";  
  }  
  }  
                  whichEl1   =   eval(el   +   "Child");  
                  if   (whichEl1.style.display   ==   "none")   {  
                          whichEl1.style.display   =   "block";  
                  }  
                  else   {  
                          whichEl1.style.display   =   "none";  
                  }  
          }  
          else   {  
                  whichEl   =   eval("document."   +   el   +   "Child");  
  for(i=1;i<=numTotal;i++){  
  whichEl   =   eval("document."   +   scores[i]   +   "Child");  
  if(whichEl!=whichEl1)   {  
  whichEl.visibility   =   "hide";  
  }  
  }  
                  if   (whichEl.visibility   ==   "hide")   {  
                          whichEl.visibility   =   "show";  
                  }  
                  else   {  
                          whichEl.visibility   =   "hide";  
                  }  
                  arrange();  
          }  
  }  
  onload   =   initIt;  
  </SCRIPT>  
   
  这个可以吗?效果你可以去http://www.51javascript.net/free/Page-Details/search10.htm#看看:)Top

4 楼emu(月亮不在手指尖上)回复于 2002-06-12 00:21:11 得分 20

http://www.csdn.net/Expert/forum.asp?typenum=8&searchKeys=%CA%F7&roomid=27&author=&tabletype=now  
   
  看看,都被问烂了Top

5 楼uncarman()回复于 2002-06-12 15:32:36 得分 0

这倒也是,这个问题我已解决。还是给各位加分:)  
  Top

相关问题

  • 特急,asp如何实现树状菜单结构?
  • 请问微软网站上的树状菜单是怎么实现的?
  • 请问,微软网站上的树状菜单是怎么实现的?谢谢!!!
  • 请问怎样实现导航栏的树状结构,像CSDN的一样!
  • 导航菜单要怎么实现??
  • 树状菜单300分
  • 各位大虾帮忙!怎样实现动态多级树状菜单,数据从数据库中读取
  • 生成树状菜单问题?
  • 关于树状菜单超链接
  • 大的树状菜单问题??

关键词

  • .net
  • 导航
  • 树状导航菜单
  • 看看
  • www

得分解答快速导航

  • 帖主:uncarman
  • seabell
  • crazylily
  • emu

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo