firefox中JS读取XML文件_javascript技巧

WBOY
Release: 2016-05-16 19:23:05
Original
916 people have browsed it
firefox中JS读取XML文件
在网上搜“firefox中JS读取XML文件”的方法,找了半天,好多都是问了没人答的。看到一堆程序员在抱怨firefox:“除了累死程序员没什么好处。”,言归正传。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对象了。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!