MzTreeView.prototype.newExpand = function (id)
{
var currentNode = this.node[id];
if (!currentNode.hasChild||currentNode.isExpand)
{
this.expand(id);
return;
}
var childNodes = currentNode.parentNode.childNodes;
for (var index in childNodes)
{
if (childNodes[index]==currentNode)
this.expand(id,true);
else
this.expand(childNodes[index].id,false);
}
}
//树的单击事件处理函数
MzTreeView.prototype.clickHandle = function(e)
{
e = window.event || e; e = e.srcElement || e.target;
//alert(e.tagName)
switch(e.tagName)
{
case "IMG" :
if(e.id)
{
/*
if(e.id.indexOf(this.name +"_icon_")==0)
this.focusClientNode(e.id.substr(e.id.lastIndexOf("_") + 1));
else if (e.id.indexOf(this.name +"_expand_")==0)
this.newExpand(e.id.substr(e.id.lastIndexOf("_") + 1));
*/
this.focusClientNode(e.id.substr(e.id.lastIndexOf("_") + 1));
this.newExpand(e.id.substr(e.id.lastIndexOf("_") + 1));
}
break;
case "A" :
if(e.id) this.focusClientNode(e.id.substr(e.id.lastIndexOf("_") + 1));
this.newExpand(e.id.substr(e.id.lastIndexOf("_") + 1));
break;
case "SPAN" :
if(e.className=="pm")
this.newExpand(e.id.substr(e.id.lastIndexOf("_") + 1));
break;
default :
if(this.navigator=="netscape") e = e.parentNode;
if(e.tagName=="SPAN" && e.className=="pm")
this.newExpand(e.id.substr(e.id.lastIndexOf("_") + 1));
break;
}
};完整的太长贴不上来
我要每一个node都不展开。