我怎么在我的JSP页面中加入一个树型控件?? 可以呀,作一个Applet就行了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 楼上的,贴个出来看看,Applet的树在页面上怎么传参数啊?!要根据树来显示页面的啊。 IE中有个这样的activex控件,可以js控制asp.net中有个这样的控件,后台数据库控制非常好 /*************************************** ***************************************/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; }太长了~~~~~~~~~~~~~~~~~~~~~ jsp代码错误,求指导 clob字段更新问题 问哪简单的SQL,或算法 为什么还是有异常?STRUTS配置文件已经写跳转了啊 索引超出了数组界限。 没有积分了但是我今天很需要那个软件怎么办啊? web.xml设置问题,紧急求助! 请教关于jsp开发的一些基本问题 我的页面刷新不了?.... 写了一个filter在tomcat下有效果,但在weblogic下无效果,帮忙看看 准备看jdbc,有什么好的电子书跟技术文章 推荐一下!!!!多谢 不提交,JSP怎么访问本页面中表单的内容
asp.net中有个这样的控件,后台数据库控制非常好
***************************************/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;
}
太长了~~~~~~~~~~~~~~~~~~~~~