<html>
<script src="Treeview.js"></script>
<script>
function genCB(name,value,title){
return "<font style='font-size:12px'><input type='checkbox' name='"+name+"' value='"+value+"'>"+title+"</font>";
}
function genRB(name,value,title){
return "<font style='font-size:12px'><input type='radio' name='"+name+"' value='"+value+"'>"+title+"</font>";
}
function genPlain(txt){
return "<font style='font-size:12px'>"+txt+"</font>";
}
function iterator(pTreeNode,pXmlNode){
for(var child=pXmlNode.firstChild;child!=null;child=child.nextSibling){
var key=child.getAttribute("key");
var value=child.getAttribute("value");
if(child.firstChild){
var treeNode = insFld(pTreeNode, gFld(genRB('tn',key,value)));
iterator(treeNode,child);
}else{
insDoc(pTreeNode, gLnk(genCB('tn',key,value)));
}
}
}
ImageDir = "TV/";//树的图片目录
var fT = gFld(genPlain("选择区域"));//建立树根
newXML=new ActiveXObject("Microsoft.XMLDOM");
newXML.load("CascadedSelectTree.xml");//导入数据XML
var XMLNode = newXML.documentElement;//建立XML根
//初始化树
iterator(fT,XMLNode);
</script>
<table id='treetable' name='treetable' border="0" width="100" cellspacing="0" cellpadding="0">
<tr><td><script>ini(fT)</script></td></tr>
</table>
<script>
cON(1);cON(4);cON(5);cON(7);//预先打开某些节点
</script>
</html>