/*--------------------------------------------------| | 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 object function Node(id, pid, name, url,icon,iconClose,iconOpen,description,position,open,attributes) { this.id = id; //id this.pid = pid;//父id this.name = name;//节点显示名称 this.url = url;//单击节点时候a标签的链接地址 this.icon = icon; //图标 this.iconClose = iconClose; //图标 this.iconOpen = iconOpen;//打开时图标 this.description = description; this.position = position; this.attributes = attributes||{}; this.open = open; this._io = open || false; //是否被打开 this._is = false; //是否被选中 this._ls = false; //是否是父节点的最后一个子节点 this._hc = false; //是否存在子节点 this._ai = 0;//被添加的索引 this._p; //父节点 }; //触发contextMenu事件 function dTreeContextMenuEvent(dtree) { var allNodesArr = dtree.aNodes; for(var i=0;i'; } else { str += ''; } } if(node._is) { this.selectedNode = nodeId; } if (node.pid != this.root.id) { str += ''; //str += ''; //str +=''; } str += node.name+''; str += ''; if (node._hc) { str += '
'; str += this.addNode(node); str += '
'; } this.aIndent.pop(); return str; }; // Adds the empty and line icons dTree.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 sibling dTree.prototype.setCS = function(node) { var lastId; for (var n=0; n