资源预览内容
第1页 / 共19页
第2页 / 共19页
第3页 / 共19页
第4页 / 共19页
第5页 / 共19页
第6页 / 共19页
第7页 / 共19页
第8页 / 共19页
第9页 / 共19页
第10页 / 共19页
亲,该文档总共19页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
1.简单目录树的实现利用 div.style.display=none block 实现。参考 http:/bbs.51js.com/viewthread.php?tid=79791span cursor:pointer;.T2 padding-left:20px;function hidden(j)var URL=http:/www.zzsky.cn/effect/images/treemenu/;for(var i=0;i无忧脚本 1第一项 1第一项 1第二项 1第三项 1第四项 1第五项 1无忧脚本 2第一项 2第一项 2第二项 2第三项 2第四项 2第五项 2无忧脚本 3第一项 3第一项 3第二项 3第三项 3第四项 3第五项 3百度2.高级目录树参考 http:/www.destroydrop.com/javascripts/tree/SVN 地址:svn:/www.svnhost.cn/js_tree1.example.htmlDestroydrop TreeDestroydrop Javascripts TreeExampleopen all | close all2002-2003 Geir Landr2. dtree.js/*-| dTree 2.05 | www.destroydrop.com/javascript/tree/ |-| Copyright (c) 2002-2003 Geir Landr? | | This script can be used freely as long as all | copyright messages are intact. | | Updated: 17.04.2003 |-*/ Node objectfunction Node(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 | false;this._is = false;this._ls = false;this._hc = false;this._ai = 0;this._p;/ Tree objectfunction dTree(objName) this.config = target : null,folderLinks : true,useSelection : true,useCookies : true,useLines : true,useIcons : true,useStatusText : false,closeSameLevel : false,inOrder : falsethis.icon = root : img/base.gif,folder : 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/nolines_plus.gif,nlMinus : img/nolines_minus.gif;this.obj = objName;this.aNodes = ;this.aIndent = ;this.root = new Node(-1);this.selectedNode = null;this.selectedFound = false;this.completed = false;/ Adds a new node to the node arraydTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) this.aNodesthis.aNodes.length = new Node(id, pid, name, url, title, target, icon, iconOpen, open);/ Open/close all nodesdTree.prototype.openAll = function() this.oAll(true);dTree.prototype.closeAll = function() this.oAll(false);/ Outputs the tree to the pagedTree.prototype.toString = function() var str = n;if (document.getElementById) if (this.config.useCookies) this.selectedNode = this.getSelected();str += this.addNode(this.root); else str += Browser not supported.;str += ;if (!this.selectedFound) this.selectedNode = null;this.completed = true;return str;/ Creates the tree structuredTree.prototype.addNode = function(pNode) var str = ;var n=0;if (this.config.inOrder) n = pNode._ai;for (n; n + this.indent(node, nodeId);if (this.config.useIcons) if (!node.icon) node.icon = (this.root.id = node.pid) ? this.icon.root : (node._hc) ? this.icon.folder : this.icon.node);if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node;if (this.root.id = node.pid) node.icon = this.icon.root;node.iconOpen = this.icon.root;str += ;if (node.url) str += ;else if (!this.config.folderLinks | !node.url) & node._hc & node.pid != this.root.id)str += ;str += node.name;if (node.url | (!this.config.folderLinks | !node.url) & node._hc) str += ;str += ;if (node._hc) str += ;str += this.addNode(node);str += ;this.aIndent.pop();return str;/ Adds the empty and line iconsdTree.prototype.indent = function(node, nodeId) var str = ;if (this.root.id != node.pid) for (var n=0; n;(node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);if (node._hc) str += ; else str += ;return str;/ Checks if a node has any children and if it is the last siblingdTree.prototype.setCS = function(node) var lastId;for (var n=0; nthis.aNodes.length; n+) if (this.aNodesn.pid = node.id) node._hc = true;if (this.aNodesn.pid = node.pid) lastId = this.aNodesn.id;if (lastId=node.id) node._ls = true;/ Returns the selected nodedTree.prototype.getSelected = function() var sn = this.getCookie(cs + this.obj);return (sn) ? sn : null;/ Highlights the selected nodedTree.prototype.s = function(id) if (!this.config.useSelection) return;var cn = this.aNodesid;if (cn._hc if (this.selectedNode != id) if (this.selectedNode | this.selectedNode=0) eOld = document.getElementById(s + this.obj + this.selectedNode);eOld.className = node;eNew = document.getElementById(s + this.obj + id);eNew.className = nodeSel;this.selectedNode = id;if (this.config.useCookies) this.setCookie(cs + this.o
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号