firefox并不支持selectSingleNode和selectNodes的解决方法

function test(){
var perid = document.thisForm.PerID.value; var xml="test";
if(window.ActiveXObject){
var xml=new ActiveXObject("Microsoft.XMLDOM");
xml.async=false;
xml.load("xxxx.xml"); }else if((typeof document.implementation != 'undefined')&&
(typeof document.implementation.createDocument!='undefined')){
xml = document.implementation.createDocument("", "", null); xml.async=false;
xml.load("xxxx.xml"); //firefox并不支持selectSingleNode和selectNodes方法;下面两段是用XPath来解决firefox模拟selectSingleNode和selectNodes方法,正确性有待解决
XMLDocument.prototype.selectSingleNode = Element.prototype.selectSingleNode = function (xpath){
var x = this .selectNodes(xpath)
if ( ! x || x.length < 1 ) return null ;
return x[ 0 ];
}
XMLDocument.prototype.selectNodes = Element.prototype.selectNodes = function (xpath){
var xpe = new XPathEvaluator();
var nsResolver = xpe.createNSResolver( this .ownerDocument == null ?
this .documentElement : this .ownerDocument.documentElement);
var result = xpe.evaluate(xpath, this , nsResolver, 0 , null );
var found = [];
var res;
while (res = result.iterateNext())
found.push(res);
return found;
} }
//下面就可以用selectSingleNode和selectNodes方法
var row=null; if(perid.substring(0,5)=="NO" && perid.length==9){
row=xml.selectSingleNode("root/row[@ID='"+perid+"']");
if (row!=null){
document.thisForm.MenuColor.value=row.getAttribute("CssFileName");
ChangeBgColor(document.thisForm.MenuColor.value);
}
} }

firefox chrome ie9,10,11 不支持selectSingleNode和selectNodes的解决方法的更多相关文章

  1. firefox并不支持selectSingleNode和selectNodes的解决方法

    转自:http://qsrock.iteye.com/blog/209585 function test(){ var perid = document.thisForm.PerID.value; v ...

  2. 其他浏览器(firefox,chrome)可以上网 ie(Internet Explorer)无法上网 解决方法

    http://blog.csdn.net/andywangcn/article/details/8945366

  3. 不支持关键字“metadata”问题的解决方法

    不支持关键字“metadata”问题的解决方法 原来的语句: metadata=res://*/Models.CallCenterEntities2.0.csdl|res://*/Models.Cal ...

  4. CenOS下firefox browser (火狐浏览器)无法播放网页音乐的解决方法

    新装载的Firefox或许无法播放网页音频,解决方法如下: 1. 下载并安装 flashplayer插件&&下载网址:https://get.adobe.com/flashplayer ...

  5. 关于“类不能支持Automation操作”错误的解决方法

    一段程序IE上老是提示“类不支持Automation操作”的错误,IE6.7.8都一样,但是Firefox可以,后来网上找到如下解决方法: 重新注册下以下文件,问题便解决了:msscript.ocxd ...

  6. OSX 10.14.2 安装Cocoapods 出现问题的解决方法

    今天尝试用 Cocoapods安装个第三方库.. 输入pod install, 发现 command not find. WTF! 估计是升级10.11后Cocoapods被干掉了. 我输入 sudo ...

  7. PLSQL Developer不支持Oracle 64位客户端解决方法

    问题描述: 在虚拟机同网段,搭建Oracle 11.2.04数据库64位的,本机操作系统Win10 x64和PLSQL 9.03,目前想利用PLSQL远程登录ORACLE数据库操作.当初用 insta ...

  8. chrome浏览器模拟手机端:jquery click()点击无效解决方法

    $(".sku-wrap .ok").click(); chrome浏览器模拟手机端,在油猴插件中写JS代码,然后发现click()点击失效. 解决方法:jquery的click( ...

  9. error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int 错误的解决方法

    一些函数定义中,在VC6中,如果没有显示的指定返回值类型,编译器将其视为默认整型:但是vs2008/vs2010不支持默认整型,解决这个问题不能修改每个没有显示指示返回值类型的函数地方,可以用排除44 ...

随机推荐

  1. delphi 服务程序

    http://www.delphifans.com/InfoView/Article_662.html 用Delphi创建服务程序 Windows 2000/XP和2003等支持一种叫做"服 ...

  2. dos下 和 批处理中的 for 语句的基本用法

    for 语句的基本用法 : 最复杂的for 语句,也有其基本形态,它的模样是这样的:   在cmd 窗口中:for %I in (command1) do command2 在批处理文件中:for % ...

  3. 解决ASP.NET MVC4中使用Html.DropDownListFor显示枚举值默认项问题

    从ASP.NET MVC 5开始,Html.DropDownListFor已经提供了对Enum的支持,但在这以前,需要通过帮助方法或扩展方法来让Html.DropDownListFor显示枚举值. 本 ...

  4. canvas使用1

    画直线: ? 1 2 3 4 5 6 7 8 9 10 11 var c = document.getElementById("myCanvas"); //不要忘写document ...

  5. oracle监听1067错误的处理

    一,oracle监听1067错误的处理修改oracle安装目录D:\DataBase\oracle\product\10.1.0\Db_1\NETWORK\ADMIN\下的 listener.ora和 ...

  6. 设计原则:多使用Specialized Types

    使用Specialized Types的好处: 可以服用:验证.计算. 更高的编程层次. 容易在UI层封装组件.

  7. rtsp实现的开源代码

    * live.com   C/S   C++   http://www.live555.com * darwin     S     C++   http://www.opensource.apple ...

  8. jQuery - 同时添加click和dblclick事件

    添加事件的代码比较简单,有两种方法: $("abc").bind({"click":fn,"dblclick":fn}); $(" ...

  9. 处理【Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operatio】

    错误详情]:{DAL:DAL05}{Host:192.168.100.158}Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf ...

  10. IOS判断用户的网络类型(2/3/4G、wifi)

    直接贴代码吧,ios7之后是获取的较为准确,7以下我拿iphone5测试的是无法区分3g/2g.连iphone4都能升到7.1.4,而且目前主流的设备7以下的系统已经很少了,这个方案尽管不太完美,但影 ...