文件说明 | |||
序号 | 文件名 | 说明 | |
1 | css/tree.css | ||
2 | img/tree | mztreeview树的图片文件 | |
3 | js | jquery-1.3.2.min.js | jQuery库文件 |
jquery.blockUI.js | jQuery的block插件,加载子节点等待时界面屏蔽 | ||
jquery.xmldom.min.js | jQuery的xml处理插件,加载的子节点为xml格式时,此JS文件为必须的 | ||
4 | MzTreeView14.js | 1.4版本MzTreeView的JS文件 | |
代码示例 | |||
js 代 码 | <script type="text/javascript"> var tree = new MzTreeView("tree"); tree.setIconPath("img/tree/"); //可用相对路径 tree.N["0_1"] = "T:WEB 编程"; tree.N["1_100"] = "T:代码示例; data:id=100"; tree.N["1_200"] = "T:异步加载[JSON];asyncJSON:asyncJSON.jsp?startId=200"; tree.N["1_250"] = "T:异步加载[XML];asyncXML:asyncXML.jsp?startId=2000"; tree.N["1_310"] = "T:CSS;data:id=310"; tree.N["1_320"] = "T:DHTML;data:id=320"; tree.N["1_300"] = "T:HTML; data:id=300"; tree.N["1_400"] = "T:JavaScript; icon:book; data:id=400"; tree.N["320_322"] = "T:属性;data:id=322;dblClick:treeDblClick(322)"; tree.N["320_323"] = "T:方法;data:id=323"; tree.N["320_324"] = "T:事件;data:id=324"; tree.N["320_325"] = "T:集合;data:id=325"; tree.N["400_407"] = "T:对象;data:id=407"; tree.N["400_406"] = "T:方法;data:id=406"; tree.N["400_408"] = "T:运算符;data:id=408"; tree.N["400_409"] = "T:属性;data:id=409"; tree.N["407_1140"] = "T:Date;url:Article.asp; data:id=140"; tree.N["406_1127"] = "T:toString;url:Article.asp; data:id=127"; tree.N["408_1239"] = "T:||;url:Article.asp; data:id=239"; tree.N["409_1163"] = "T:E;url:Article.asp; data:id=163"; document.getElementById("treeTd").innerHTML = tree.toString(); </script> | ||
说明 | 1.增加dblClick属性实现双击功能,属性值为javascript函数; 2.增加asyncJSON属性实现按照JSON数据格式异步加载子节点功能,属性值为指向服务端提供的一个JSP,Servlet等服务的路径,此服务提供JSON格式的输出 3.增加asyncXML属性实现按照XML格式异步加载子节点功能,属性值为指向服务端提供的一个JSP,Servlet等服务的路径,此服务提供XML格式的输出
| ||
JSON数据格式如下: [{"asyncJSON":"asyncJSON.jsp?startId=301","asyncXML":"","dblClick":"","expand":false,"hasChild":false,"hint":"","icon":"","id":301,"load":false,"path":"","sourceIndex":"","T":"JSON节u28857 201"},{"asyncJSON":"","asyncXML":"","dblClick":"","expand":false,"hasChild":false,"hint":"","icon":"","id":302,"load":false,"path":"","sourceIndex":"","T":"JSON节u28857 202"}] XML数据格式如下: <?xml version="1.0" encoding="UTF-8"?><nodes><node><attr name="id" value="2003"></attr><attr name="T" value="AXML节点[2003]"></attr><attr name="C" value="alert('说明A')"></attr></node><node><attr name="id" value="2004"></attr><attr name="T" value="BXML节点[2004]"></attr><attr name="C" value="alert('说明B')"></attr><attr name="url" value="http://www.csdn.net/"></attr></node><node><attr name="id" value="2005"></attr><attr name="T" value="CXML节点[2005]"></attr><attr name="asyncJSON" value="asyncJSON.jsp?startId=2005"></attr></node></nodes> | |||
下载地址:http://download.csdn.net/source/2183703