function addNode() {
if (tree.getSelected()) {
treeid = tree.getSelected().para;
arr_ = tree.getSelected().childNodes;
//if (layer==0) return;
if(arr_.length > 0) {
////////
}else{
//new_ = tree.getSelected().add(new WebFXTreeItem('sohu','www.sohu.com'));
http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!http_request) {
alert("http_request 对象为空!");
return false;
}
http_request.onreadystatechange = function() {
if (http_request.readyState == 2) {
// 正在装载
}else if (http_request.readyState == 4) {
// 完成
if (http_request.status == 200) {
resStr = http_request.responseText;
if (resStr==""){
array_ = new Array(0);
}else{
array_ = resStr.split("§№☆");
}
//alert(resStr);
//alert("个数="+array_.length);
for(i=0;i<(array_.length);i++){
obj=array_[i].split("■△▲");
nodename = obj[0];
actions = obj[1];
paras=obj[2];
//alert(nodename+" "+actions+" "+paras);
tree.getSelected().add(new WebFXTreeItem(nodename,actions,paras));
}
} else {
alert("返回值错误!");
}
} else {
// still not ready
}
};
var url="<%=request.getContextPath() %>/skeleton/organization.do?todo=contentTreeAction&treeid="+treeid;
http_request.open('GET', url, true);
http_request.send(null);
}
}
}
posted on 2007-04-17 14:24
NG 阅读(164)
评论(0) 编辑 收藏