JTree(树状控件)(转载)
程序名:JTree(树状控件)结合了XML的长处,使您只需几行代码就可以拥有像Windows的资源管理器一样的Treeview了。
之前,本人曾写过一个Treeview,但是,不够美观,这一版本,在外观上做了很大的改进,很漂亮。运行速度很快。
-------------------------------------------------------
原版
详细功能请见示例。
[url=http://www.chancesoft.net/picture/JTree/demo.htm][color=#0000ff]示例[/color][/url]
[url=http://www.chancesoft.net/picture/JTree/JTree.rar][color=#0000ff]打包下载[/color][/url]
-------------------------------------------------------
更新版
更新日期:2006/01/06
更新功能:加入treeNodes(数组形式),通过treeNodes可以对指定的子树进行收缩和展开功能,查找指定节点的功能
[color=red]内附详细说明书[/color]
[url=http://www.bag-leather.com/pro/JTree/demo2.htm][color=#810081]示例[/color][/url]
[url=http://www.bag-leather.com/pro/JTree/JTree2.0.rar][color=#810081]打包下载[/color][/url]
加入这些功能之后,个人感觉有些混乱。不过,现在没有时间整理。待下一版吧
请保留作者信息
-------------------------------------------------------
最新更新:2006/12/05
更新功能:加入全部展开,全部隐藏
http://bbs.blueidea.com/thread-2700565-1-2.html
-------------------------------------------------------
JTree在onclick时,有两个值可以用: 代码: var myTree=new JTree("showTree","vogueType.xml");
myTree.setPicPath("img/")
myTree.onclick=function(){
//alert(myTree.selectNode.parentNode.attributes.getNamedItem("explain").nodeValue);
//alert(myTree.clickItem.level)
setValueById("typeCaption",getNodeAtt(myTree.selectNode,"caption"));
setValueById("parentType",getNodeAtt(myTree.selectNode.parentNode,"caption"));
setValueById("PRI",getNodeAtt(myTree.selectNode,"PRI"));
setValueById("explain",getNodeAtt(myTree.selectNode,"explain"));
setValueById("level",myTree.clickItem.level);
}
myTree.CAPTI;
myTree.create();
代码:myTree.selectNode
这是一个XML节点, 代码:myTree.clickItem
像当于一个记录型变量。
它的原型如下: 代码:function clickNode(){
this.obj =null;
this.caption =null;
this.level =null;
this.value =null;
}
部分代码解释: 代码:var self =this; //相当于一个引用,指向自己。JTree.
self实际上就像当于一个指针(见JTree.js的开头部分)
程序代码很简单,只要用心读。 FF下也可以跑
页:
[1]