当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 一个以Javascript+xml的树型列表

Javascript
javascript 汉字与拼音转换
JavaScript使用cookie
大平洋汽车网左侧菜单
使用JS操作页面表格,元素的一些技巧
分享我学习js的过程 作者aircy javascript学习教程
张孝祥JavaScript学习阶段性总结(2)--(X)HTML学习
用js来生成随机彩票号码清单
发一个数据过滤的代码,很简单,有用的着的拿去
如何在标题栏显示框架内页面的标题
js滚动条多种样式,推荐
再次更新!MSClass (Class Of Marquee Scroll通用不间断滚动JS封装类 Ver 1.6)
符合web标准的连续滚动图像的js代码
使用iframe作为日历的载体,不再被select和flash等控件挡住的日期输入框
通过脚本控制指定内容不能被选择
模拟弹出窗口效果,关闭层之前,不能选择后面的页内容
另类弹出窗口,跳过所有拦截工具
使用prototype.js进行异步操作
JS模拟多线程
动态增加/删除文件域
[分享]一个非常漂亮的进度滚动条

一个以Javascript+xml的树型列表


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-04   浏览: 293 ::
收藏到网摘: n/a

这是在www.java2s.com网站下载的一个以Javascript+xml的树型列表,这个列表界面非常的漂亮,但是由于里面内容比较复杂,而现在项目需要用到这个列表,我到现在还没有摸清怎么在里面让点击一个树型的项目转到别的网页里面去,希望有兴趣的朋友一起研究一下。
部分代码如下: 
 <script> 
  
function dtmlXMLLoaderObject(funcObject,dhtmlObject){ 
 this.xmlDoc=""; 
 this.onloadAction=funcObject||null; 
 this.mainObject=dhtmlObject||null; 
 return this; 
}; 
  
 dtmlXMLLoaderObject.prototype.waitLoadFunction=function(dhtmlObject){ 
 this.check=function(){ 
 if(!dhtmlObject.xmlDoc.readyState)dhtmlObject.onloadAction(dhtmlObject.mainObject); 
 else{ 
 if(dhtmlObject.xmlDoc.readyState != 4)return false; 
 else dhtmlObject.onloadAction(dhtmlObject.mainObject);} 
}; 
 return this.check; 
}; 
  
  
 dtmlXMLLoaderObject.prototype.getXMLTopNode=function(tagName){ 
 if(this.xmlDoc.responseXML){var temp=this.xmlDoc.responseXML.getElementsByTagName(tagName);
var z=temp[0];} 
 else var z=this.xmlDoc.documentElement; 
 if(z)return z; 
 alert("Incorrect XML"); 
 return document.createElement("DIV"); 
}; 
  
  
 dtmlXMLLoaderObject.prototype.loadXMLString=function(xmlString){ 
 try  

 var parser = new DOMParser(); 
 this.xmlDoc = parser.parseFromString(xmlString,"text/xml"); 

 catch(e){ 
 this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 
 this.xmlDoc.loadXML(xmlString); 

 this.onloadAction(this.mainObject); 

 dtmlXMLLoaderObject.prototype.loadXML=function(filePath){ 
 try  

 this.xmlDoc = new XMLHttpRequest(); 
 this.xmlDoc.open("GET",filePath,true); 
 this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this); 
 this.xmlDoc.send(null); 

 catch(e){ 
 if(document.implementation && document.implementation.createDocument) 

 this.xmlDoc = document.implementation.createDocument("","",null); 
 this.xmlDoc.onload = new this.waitLoadFunction(this); 

 else 

 this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 
 this.xmlDoc.async="true"; 
 this.xmlDoc.onreadystatechange=new this.waitLoadFunction(this); 

 this.xmlDoc.load(filePath); 

}; 
  
  
function callerFunction(funcObject,dhtmlObject){ 
 this.handler=function(e){ 
 if(!e)e=event; 
 funcObject(e,dhtmlObject); 
 return true; 
}; 
 return this.handler; 
}; 

function getAbsoluteLeft(htmlObject){ 
 var xPos = htmlObject.offsetLeft; 
 var temp = htmlObject.offsetParent; 

 while(temp != null){ 
 xPos+= temp.offsetLeft; 
 temp = temp.offsetParent; 

 return xPos; 

  
function getAbsoluteTop(htmlObject){ 
 var yPos = htmlObject.offsetTop; 
 var temp = htmlObject.offsetParent; 
 while(temp != null){ 
 yPos+= temp.offsetTop