当前位置: 代码迷 >> Web前端 >> dtree 创造动态树时要新增进行点击事件且不跳其他页面
  详细解决方案

dtree 创造动态树时要新增进行点击事件且不跳其他页面

热度:519   发布时间:2012-11-23 00:03:43.0
dtree 创建动态树时要新增进行点击事件且不跳其他页面
var xmlHttp1; 
function createXmlHttpRequestadlist(){
//判断用户所使用的浏览器
if(window.ActiveXObject){
xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");          
}else if(window.XMLHttpRequest){
xmlHttp1= new XMLHttpRequest();
}
}
//用户点击发送请求
function startRequestadlist(){
createXmlHttpRequestadlist();          
//设置回调函数
xmlHttp1.onreadystatechange=callbackadlist;
    var url = '../system/organizeAction!getorgnames1.action';    
    xmlHttp1.open("get",url,true);
    xmlHttp1.send(null);
}
function callbackadlist(){
if(xmlHttp1.readyState==4){
if(xmlHttp1.status==200){
//处理结果       
domXmladlist();
}
}
}
  function domXmladlist(){    
    var organize = xmlHttp1.responseXML.getElementsByTagName("organize");
    //alert(organize.length); 
d = new dTree('d',"../common/dtree/img/"); 
for(var i=0;i<organize.length;i++){
//alert(xmlHttp1.responseXML.getElementsByTagName("orgid")[i].firstChild.nodeValue);     
//alert(xmlHttp1.responseXML.getElementsByTagName("orgname")[i].firstChild.nodeValue);
   var orgid=xmlHttp1.responseXML.getElementsByTagName("orgid")[i].firstChild.nodeValue;
   //var uporgid=xmlHttp1.responseXML.getElementsByTagName("uporgid")[i].firstChild.nodeValue;         
   d.add(xmlHttp1.responseXML.getElementsByTagName("orgid")[i].firstChild.nodeValue,
xmlHttp1.responseXML.getElementsByTagName("uporgid")[i].firstChild.nodeValue,
xmlHttp1.responseXML.getElementsByTagName("orgname")[i].firstChild.nodeValue,
'javascript:click('+orgid+')','','');
   // alert(d.node);
}
   document.getElementById('show').innerHTML=d;     
                                               }

                                           function click(orgid){              
。。。。。。。。。。。。。。。。。。                                
}