写了个XML+Tree无穷树js版
.select
{
width:80%;
border:0px solid #bfbfbf;
}
.options
{
width:98%;
border:0px solid #ff0000;
}
.tree
{
width:92%;
border:0px solid #ff0000;
}
//
var Box = function ()
{
return document.createElement("div");
}
//
//
var desktop = document.body;
//
//
//
var Options = function ()
{
//
}
var Tree = function ()
{
//
var _this = this;
this._select = null;
this._options = null;
//
this.create = function (level,xml)
{
var space = "";
for(var i=0;i0)
{
this._tree = new Box();
this._options.appendChild(this._tree);
this._tree.style.display = "inline";
Tree.apply(this._tree);
//
this._tree.className = "tree";
this._tree.create(level+1,xml.childNodes[i]);
}
else
{
var div = new Box();
this._options.appendChild(div);
div.innerHTML = space+" "+"[-]"+xml.childNodes[i].attributes[0].value;
}
//
}
//
}
}
//
var tree = new Box();
desktop.appendChild(tree);
Tree.apply(tree);
tree.className = "tree";
tree.style.left = 400;
tree.create(0,Login.documentElement);
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
.select
{
width:80%;
border:0px solid #bfbfbf;
}
.options
{
width:98%;
border:0px solid #ff0000;
}
.tree
{
border:0x solid #ff0000;
}
.treeView
{
height:400px;
width:300px;
border:1x solid #ff0000;
overflow:auto;
}
//
var Box = function ()
{
return document.createElement("div");
}
//
//
var desktop = document.body;
//
//
//
var Options = function ()
{
//
}
var Tree = function ()
{
//
var _this = this;
this._select = null;
this._options = null;
//
this.create = function (level,xml)
{
var space = "";
for(var i=0;i0)
{
this._tree = new Box();
this._options.appendChild(this._tree);
this._tree.style.display = "inline";
Tree.apply(this._tree);
//
this._tree.className = "tree";
this._tree.create(level+1,xml.childNodes[i]);
}
else
{
var div = new Box();
this._options.appendChild(div);
div.innerHTML = space+" "+"[-]"+xml.childNodes[i].attributes[0].value;
}
//
}
//
}
}
//
var tree = new Box();
desktop.appendChild(tree);
Tree.apply(tree);
tree.className = "treeView";
tree.style.left = 400;
tree.create(0,Login.documentElement);
//
var tree1 = new Box();
desktop.appendChild(tree1);
Tree.apply(tree1);
tree1.className = "treeView";
tree1.style.position = "absolute";
tree1.style.top = 100;
tree1.style.left = 400;
tree1.create(0,Login.documentElement);
//
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]