function initTreeNode(dtree)
{
var xmlDoc = new ActiveXObject("Microsoft.xmldom");
xmlDoc.async=false;
xmlDoc.load("PatientInfo.xml");//加载xml文件
if(xmlDoc.parseError.errorCode != 0)
window.alert(xmlDoc.parseError.reason);
else{
var nodes = xmlDoc.getElementsByTagName("type");//获取名称为type的节点
var node = nodes.nextNode; //获取下一个节点
var i=0;
var j=1000;
while(node != null)
{
dtree.add(++i,0,node.getAttribute("name"),"","workAreaFame","","img/folder.gif","",true); //node.getAttribute("name")获取节点的属性值
var tempNodes = node.childNodes;//获取节点集合
var tempNode =tempNodes.nextNode;//移动节点
while(tempNode!=null)
{
dtree.add(++j,i,tempNode.getAttribute("name"),tempNode.text+".html","workAreaFame","workAreaFame");
tempNode=tempNodes.nextNode;
}
node = nodes.nextNode;
}
}
}
posted on 2010-02-04 17:05
sanmao 阅读(719)
评论(0) 编辑 收藏