我怎么在我的JSP页面中加入一个树型控件??

tzcsdn 2003-10-09 04:08:49
能使用JBuild9中提供的树型控件吗??我是新手,谢谢了!
...全文
141 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
xinshou1979330 2003-10-09
  • 打赏
  • 举报
回复
关注
我也在找此问题的解决方法啊

drip 2003-10-09
  • 打赏
  • 举报
回复
hh
tzcsdn 2003-10-09
  • 打赏
  • 举报
回复
看不太懂,怎么用呀,多谢了!
thefishwilldie 2003-10-09
  • 打赏
  • 举报
回复
/***************************************

***************************************/

var webFXTreeConfig = {
rootIcon : 'images/foldericon.png', //根节点图标
openRootIcon : 'images/openfoldericon.png', //打开根节点图标
folderIcon : 'images/foldericon.png', //节点图标
openFolderIcon : 'images/openfoldericon.png', //打开节点图标
fileIcon : 'images/file.png', //支点图标
iIcon : 'images/I.png', //树结构的竖"|"标志
lIcon : 'images/L.png', //树结构的竖"L"标志
lMinusIcon : 'images/Lminus.png', //节点展开后"-"标志
lPlusIcon : 'images/Lplus.png', //节点收拢"+"标志
tIcon : 'images/T.png', //树结构的"|-"标志
tMinusIcon : 'images/Tminus.png', //树结构的"|-"节点的展开后的"-"标志
tPlusIcon : 'images/Tplus.png', //树结构的"|-"节点的收拢后的"+"标志
blankIcon : 'images/blank.png', //树结构的空白标志
defaultText : '数根节点', //根节点的文本内容
defaultAction : 'javascript:if (tree.getSelected()) { alert(tree.getSelected().id);}', //默认的点击树支点的action
defaultBehavior : 'classic', //默认行为 ?????
usePersistence : true //是否持久使用 ?????
};

var webFXTreeHandler = {
idCounter : 0,
idPrefix : "节点编号是",
all : {},
behavior : null,
selected : null,
onSelect : null, /* should be part of tree, not handler */

//setId : function(nodeId) { this.idCounter=nodeId;}

getId : function() { return this.idPrefix + this.idCounter++; },
toggle : function (oItem) { this.all[oItem.id.replace('-plus','')].toggle(); },
select : function (oItem) { this.all[oItem.id.replace('-icon','')].select(); },
focus : function (oItem) { this.all[oItem.id.replace('-anchor','')].focus(); },
blur : function (oItem) { this.all[oItem.id.replace('-anchor','')].blur(); },
keydown : function (oItem, e) { return this.all[oItem.id].keydown(e.keyCode); },
cookies : new WebFXCookie(),
insertHTMLBeforeEnd :
function (oElement, sHTML) {
if (oElement.insertAdjacentHTML != null) {
oElement.insertAdjacentHTML("BeforeEnd", sHTML)
return;
}
var df; // DocumentFragment
var r = oElement.ownerDocument.createRange();
r.selectNodeContents(oElement);
r.collapse(false);
df = r.createContextualFragment(sHTML);
oElement.appendChild(df);
}
};

/*
* WebFXCookie class
*/
function WebFXCookie() {
if (document.cookie.length) { this.cookies = ' ' + document.cookie; }
}

WebFXCookie.prototype.setCookie = function (key, value) {
document.cookie = key + "=" + escape(value);
}

WebFXCookie.prototype.getCookie = function (key) {
if (this.cookies) {
var start = this.cookies.indexOf(' ' + key + '=');
if (start == -1) { return null; }
var end = this.cookies.indexOf(";", start);
if (end == -1) { end = this.cookies.length; }
end -= start;
var cookie = this.cookies.substr(start,end);
return unescape(cookie.substr(cookie.indexOf('=') + 1, cookie.length - cookie.indexOf('=') + 1));
}
else { return null; }
}

/*
* WebFXTreeAbstractNode class
*/

//抽象节点性质,节点的共有属性集

/*******************************************************
**************修改by 陈志行*******************************
*构造函数增加一个链接字段参数
*其base构造函数即WebFXTreeAbstractNode构造函数也增加了一个字段
*让节点的id可以set值
*********************************************************/

function WebFXTreeAbstractNode(linkId,sText, sAction) {
this.childNodes = [];
this.id = linkId || webFXTreeHandler.getId();
this.text = sText || webFXTreeConfig.defaultText;
this.action = sAction || webFXTreeConfig.defaultAction;
this._last = false;
webFXTreeHandler.all[this.id] = this;
}


/*
* To speed thing up if you're adding multiple nodes at once (after load)
* use the bNoIdent parameter to prevent automatic re-indentation and call
* the obj.ident() method manually once all nodes has been added.
*/

//加入节点方法
WebFXTreeAbstractNode.prototype.add = function (node, bNoIdent) {
node.parentNode = this; //node节点的父节点是this节点,即把node节点作为this节点的子节点
this.childNodes[this.childNodes.length] = node; //this节点的childNodes其中一个是node,即把node与this建立父子关系
var root = this; //把this当根节点

if (this.childNodes.length >= 2) {
this.childNodes[this.childNodes.length - 2]._last = false;
}

//如果root的父节点还有值,root的父节点就是自己
while (root.parentNode) { root = root.parentNode; }


if (root.rendered) {
if (this.childNodes.length >= 2) {

document.getElementById(this.childNodes[this.childNodes.length - 2].id + '-plus').src =
((this.childNodes[this.childNodes.length -2].folder)?
((this.childNodes[this.childNodes.length -2].open)?
webFXTreeConfig.tMinusIcon:webFXTreeConfig.tPlusIcon):webFXTreeConfig.tIcon);

this.childNodes[this.childNodes.length - 2].plusIcon = webFXTreeConfig.tPlusIcon;
this.childNodes[this.childNodes.length - 2].minusIcon = webFXTreeConfig.tMinusIcon;
this.childNodes[this.childNodes.length - 2]._last = false;
}
this._last = true;
var foo = this;
while (foo.parentNode) {
for (var i = 0; i < foo.parentNode.childNodes.length; i++) {
if (foo.id == foo.parentNode.childNodes[i].id) { break; }
}
if (i == foo.parentNode.childNodes.length - 1) { foo.parentNode._last = true; }
else { foo.parentNode._last = false; }
foo = foo.parentNode;
}
太长了~~~~~~~~~~~~~~~~~~~~~
tzcsdn 2003-10-09
  • 打赏
  • 举报
回复
我还是不明白该怎么做呀,谁能贴个实例出来,我送他50分!好着急呀,在线等,我要根据左边的树来显示页面
xhan2000 2003-10-09
  • 打赏
  • 举报
回复
IE中有个这样的activex控件,可以js控制


asp.net中有个这样的控件,后台数据库控制非常好
thefishwilldie 2003-10-09
  • 打赏
  • 举报
回复
楼上的,贴个出来看看,Applet的树在页面上怎么传参数啊?!要根据树来显示页面的啊。
crazyboy123 2003-10-09
  • 打赏
  • 举报
回复
可以呀,作一个Applet就行了。
thefishwilldie 2003-10-09
  • 打赏
  • 举报
回复
当然不能,自己写个递归生成的js文件或者网上也该能找到类似的吧。

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧