");
else
result.push("
");
}
for(var i=0;i if(elements.item(i).nodeName == "item"){//节点为树叶
var textNode = new TextNode(elements.item(i),level);
result.push(textNode.toHTML());
textNode = null;//及时释放对象
}
else if(elements.item(i).nodeType ==1){//节点为树枝
var elementNode = new ElementNode(elements.item(i),level);
result.push(elementNode.toHTML());
elementNode = null;//及时释放对象
this.parseXML(elements.item(i));
}
}
if(level != 0)result.push("
");
level = stack.pop();
}
//得到解释结果并返回
this.getTree = function(){
this.parseXML(DOMRoot);
DOMRoot = null;//释放DOM对象
return result.join("");
}
/*************静态属性***************/
JXTree.curText = null;//当前文本的id
/************静态方法***************/
JXTree.changeState = function (id){//展开或者收缩节点内容
var _body = document.getElementById(id + "_body");
var _join = document.getElementById(id+"_join");
var folder = document.getElementById(id+"_folder");
(_body.style.display == "none") ? (
_body.style.display = "block",
_join.className = _join.className.replace("plus","minus"),
folder.className = "folder_open"
) : (
_body.style.display = "none",
_join.className = _join.className.replace("minus","plus"),
folder.className = "folder_close"
)
};//changeState
JXTree.setFocus = function(id){
if(JXTree.curText)
with(document.getElementById(JXTree.curText).style){
backgroundColor = "";
color = "#000";
}
with( document.getElementById(id).style){
backgroundColor = "#003366";
color = "#FFF";
}
JXTree.curText = id;
}
}