资源描述:
《树形菜单组件dtree》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、树形菜单组件dtree/*--------------------------------------------------
2、
3、dTree2.05
4、www.destroydrop.com/javascript/tree/
5、
6、---------------------------------------------------
7、
8、Copyright(c)2002-2003GeirLandr?
9、
10、
11、
12、Thisscriptcanbeusedfreelyaslongasall
13、
14、copyrightmessagesareintact.
15、
16、
17、
18、Updated:17.04.20
19、03
20、
21、--------------------------------------------------*///NodeobjectfunctionNode(id,pid,name,url,title,target,icon,iconOpen,open){this.id=id;this.pid=pid;this.name=name;this.url=url;this.title=title;this.target=target;this.icon=icon;this.iconOpen=iconOpen;this._io=open
22、
23、false;this._is=
24、false;this._ls=false;this._hc=false;this._ai=0;this._p;};//TreeobjectfunctiondTree(objName){this.config={target:null,folderLinks:true,useSelection:true,useCookies:true,useLines:true,useIcons:true,useStatusText:false,closeSameLevel:false,inOrder:false}this.icon={root:'img/base.gif',fold
25、er:'img/folder.gif',folderOpen:'img/folderopen.gif',node:'img/page.gif',empty:'img/empty.gif',line:'img/line.gif',join:'img/join.gif',joinBottom:'img/joinbottom.gif',plus:'img/plus.gif',plusBottom:'img/plusbottom.gif',minus:'img/minus.gif',minusBottom:'img/minusbottom.gif',nlPlus:'img/
26、nolines_plus.gif',nlMinus:'img/nolines_minus.gif'};this.obj=objName;this.aNodes=[];this.aIndent=[];this.root=newNode(-1);this.selectedNode=null;this.selectedFound=false;this.completed=false;};//AddsanewnodetothenodearraydTree.prototype.add=function(id,pid,name,url,title,target,icon,ico
27、nOpen,open){this.aNodes[this.aNodes.length]=newNode(id,pid,name,url,title,target,icon,iconOpen,open);};//Open/closeallnodesdTree.prototype.openAll=function(){this.oAll(true);};dTree.prototype.closeAll=function(){this.oAll(false);};//OutputsthetreetothepagedTree.prototype.toString=funct
28、ion(){varstr='';if(document.getElementById){if(this.config.useCookies)this.selectedNode=this.getSelected();str+=this.addNode(this.root);}elsestr+='Browsernotsupported.';str+='
';if(!this.selectedFound)this.selectedNode=null;this.completed=true;returnstr;};//C