1.导入dtree文件
2.定义一个 <div class="dtree"></div>
3.在输入JS代码
<script type="text/javascript">
tree = new dTree('d');
tree.add("1","-1","中国","","","","","",false);
tree.add("11","1","北京","","","","","",false);
tree.add("110","11","东城区","连接地址可以从数据库里面动态查询出来..","东城区","打开目标位置");
tree.add("111","11","西城区","连接地址可以从数据库里面动态查询出来..","","链接在哪里显示");
tree.add("112","11","崇文区","连接地址可以从数据库里面动态查询出来..","","mainFrame");
tree.add("113","11","宣武区","","","_blank");
tree.add("114","11","朝阳区","/.jsp","","mainFrame");
tree.add("115","11","丰台区","/.jsp","","mainFrame");
tree.add("116","11","石景山区","/.jsp","","mainFrame");
tree.add("117","11","海淀区","/.jsp","","mainFrame");
tree.add("118","11","门头沟区","/.jsp","","mainFrame");
tree.add("119","11","房山区","/.jsp","","mainFrame");
tree.add("120","11","通州区","/.jsp","","mainFrame");
tree.add("121","11","顺义区","/.jsp","","mainFrame");
tree.add("122","11","昌平区","/.jsp","","mainFrame");
tree.add("123","11","大兴区","/.jsp","","mainFrame");
tree.add("124","11","怀柔区","/.jsp","","mainFrame");
tree.add("125","11","平谷区","/.jsp","","mainFrame");
tree.add("126","11","延庆县","/.jsp","","mainFrame");
tree.add("127","11","密云县","/.jsp","","mainFrame");
//==================================================
tree.add("12","1","湖南","","","","","",false);
tree.add("121","12","株洲","javascript:调用本页内的js函数","","mainFrame");
tree.add("122","12","长沙");
//====================================================
tree.add("13","1","湖北","","","","","",false);
tree.add("131","13","武汉","javascript:void()","","mainFrame");
tree.add("132","13","宜昌","javascript:void()","","mainFrame");
tree.add("133","13","孝感","javascript:void()","","mainFrame");
//===================================================
tree.add("14","1","广东","","","","","",false);
tree.add("141","14","佛山","javascript:void()","","mainFrame");
document.write(tree);
document.write(d);
</script>
4.即可生成