xtree 动态树

在web根目录下导入各个资源文件:css,js,xml文件
1.导入文件
    <script type="text/javascript" src="js/xtree.js"></script>
    <script type="text/javascript" src="js/xloadtree.js"></script>
    <script type="text/javascript" src="js/xmlextras.js"></script>
   
    <link type="text/css" rel="stylesheet" href="css/xtree.css" />

2.定义树
var tree = new WebFXTree("中国");         
      tree.add(new WebFXTreeItem("湖南"));   
      tree.add(new WebFXLoadTreeItem("江苏","xml/jiangsu.xml"));
      tree.add(new WebFXTreeItem("湖北"));    
document.write(tree)

  jiangsu.xml源码:
  <?xml version="1.0" encoding="UTF-8"?>
   <tree>
       <tree text="南京" src="xml/nanjing.xml"/>
       <tree text="无锡"/>
       <tree text="常州"/>
   </tree>
   nanjing.xml源码:
    <?xml version="1.0" encoding="UTF-8"?>
    <tree>
       <tree text="栖霞"/>
       <tree text="建邺"/>
       <tree text="鼓楼"/>
       <tree text="玄武"/>
    </tree>

你可能感兴趣的:(xml,Web,css)