firefox中JS读取XML文件

来源:互联网 发布:德利迅达银川大数据 编辑:程序博客网 时间:2024/05/16 01:57
firefox不支持ie中的ActiveXObject对象,要得到一个XML DOM有以下2种方法:
1、document.implementation.createDocument("", "", null);
2、window.XMLHttpRequest
示例:1、var dom=document.implementation.createDocument("", "", null);
dom.async=false;
dom.load("test.xml");//dom就是xml对象了。
2、var oXmlHttp = new XMLHttpRequest() ;
oXmlHttp.open( "GET", "test.xml", false ) ;
oXmlHttp.send(null) ;
//oXmlHttp.responseXML就是xml对象了。