dwr结合xtree问题(急)
使用xtree,用dwr从后台读取数据,但是遇到问题,ie中无法显示(只显示object),但火狐中能显示树(但不能操作树,说webFXTreeHandler not defined),请教各位原因是什么?先谢谢大家了!!!
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<!-- The xtree script file -->
<!--dwr use .js-->
<script type="text/javascript" src="dwr/interface/testDwrClass.js"></script>
<script type="text/javascript" src="dwr/engine.js"></script>
<script type="text/javascript" src="dwr/util.js"></script>
<link type="text/css" rel="stylesheet" href="xtree.css"/>
</HEAD>
<BODY>
<input type="button" value="testTree" onclick="javascript:callTest01();"/>
</br>
</br>
</br>
<SCRIPT LANGUAGE="JavaScript">
var webFXTreeConfig = {
rootIcon : 'images/foldericon.png',
openRootIcon : 'images/openfoldericon.png',
folderIcon : 'images/foldericon.png',
openFolderIcon : 'images/openfoldericon.png',
fileIcon : 'images/foldericon.png',
iIcon : 'images/I.png',
lIcon : 'images/L.png',
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 : 'Tree Item',
defaultAction : 'javascript:void(0);',
defaultBehavior : 'classic',
usePersistence : true
};
var webFXTreeHandler = {
idCounter : 0,
idPrefix : "webfx-tree-object-",
all : {},
behavior : null,
selected : null,
onSelect : null, /* should be part of tree, not handler */
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
*/
function WebFXTreeAbstractNode(sText, sAction) {
this.childNodes = [];
this.id = 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;
this.childNodes[this.childNodes.length] = node;
var root = this;
if (this.childNodes.length >= 2) {
this.childNodes[this.childNodes.length - 2]._last = false;
}
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;
}