firefox中JS读取XML文件

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

firefox中JS读取XML文件

  2020-05-11 我要评论
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");/https://img.qb5200.com/download-x/dom就是xml对象了。
2、var oXmlHttp = new XMLHttpRequest() ;
oXmlHttp.open( "GET", "test.xml", false ) ;
oXmlHttp.send(null) ;
//oXmlHttp.responseXML就是xml对象了。

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们