firefox chrome ie9,10,11 不支持selectSingleNode和selectNodes的解决方法
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的解决方法的更多相关文章
- firefox并不支持selectSingleNode和selectNodes的解决方法
转自:http://qsrock.iteye.com/blog/209585 function test(){ var perid = document.thisForm.PerID.value; v ...
- 其他浏览器(firefox,chrome)可以上网 ie(Internet Explorer)无法上网 解决方法
http://blog.csdn.net/andywangcn/article/details/8945366
- 不支持关键字“metadata”问题的解决方法
不支持关键字“metadata”问题的解决方法 原来的语句: metadata=res://*/Models.CallCenterEntities2.0.csdl|res://*/Models.Cal ...
- CenOS下firefox browser (火狐浏览器)无法播放网页音乐的解决方法
新装载的Firefox或许无法播放网页音频,解决方法如下: 1. 下载并安装 flashplayer插件&&下载网址:https://get.adobe.com/flashplayer ...
- 关于“类不能支持Automation操作”错误的解决方法
一段程序IE上老是提示“类不支持Automation操作”的错误,IE6.7.8都一样,但是Firefox可以,后来网上找到如下解决方法: 重新注册下以下文件,问题便解决了:msscript.ocxd ...
- OSX 10.14.2 安装Cocoapods 出现问题的解决方法
今天尝试用 Cocoapods安装个第三方库.. 输入pod install, 发现 command not find. WTF! 估计是升级10.11后Cocoapods被干掉了. 我输入 sudo ...
- PLSQL Developer不支持Oracle 64位客户端解决方法
问题描述: 在虚拟机同网段,搭建Oracle 11.2.04数据库64位的,本机操作系统Win10 x64和PLSQL 9.03,目前想利用PLSQL远程登录ORACLE数据库操作.当初用 insta ...
- chrome浏览器模拟手机端:jquery click()点击无效解决方法
$(".sku-wrap .ok").click(); chrome浏览器模拟手机端,在油猴插件中写JS代码,然后发现click()点击失效. 解决方法:jquery的click( ...
- error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int 错误的解决方法
一些函数定义中,在VC6中,如果没有显示的指定返回值类型,编译器将其视为默认整型:但是vs2008/vs2010不支持默认整型,解决这个问题不能修改每个没有显示指示返回值类型的函数地方,可以用排除44 ...
随机推荐
- php开发之命名规则
类命名 1.使用大写的字母作为词的切割,其它字母均使用小写字母 2.名字的首字母使用大写字母 3.不要使用下划线"_" 类属性的命名 1.属性的命名应该以'm'为前缀 2.前缀'm ...
- Unity3D实践系列08, MonoBehaviour类的各种触发事件
在脚本的生命周期中,有Awake, Start, FixedUpdate, Update, LateUpdate等方法,其实这些属于MonoBehaviour类的事件响应方法,是MonoBehavio ...
- delphi 实现文件上传下载
unit UpDownFile; interface uses Windows, Classes, Idhttp, URLMon, IdMultipartFormData; const UpUrl = ...
- dll通用操作单元
dll通用操作单元 /// <author>cxg 2019-3-4</author> /// 装载(释放)DLL /// 适用于Delphi所有版本 unit ynDLL; ...
- iOS非ARC内存管理摘要 - 实践型
关于ios内存管理.在开发过程中,内存管理很重要,我简单说明一下. 1.正确用法 UIView *v = [[UIView alloc] init]; //分配后引用计数为1 [self.view a ...
- 删除 AP 发票相关脚本
/* Formatted on 2018/3/15 10:33:14 (QP5 v5.256.13226.35538) */ --发票 CREATE TABLE bak.ap_invoices_all ...
- ASP.NET MVC:Form Authentication 相关的学习资源
看完此图就懂了 看完下面文章必须精通 Form authentication and authorization in ASP.NET Explained: Forms Authentication ...
- C#泛型委托Predicate、Action、Func
Predicate Predicate泛型委托:表示定义一组条件并确定指定对象是否符合这些条件的方法.此委托由 Array 和 List 类的几种方法使用,用于在集合中搜索元素.通过查看源码发现 Pr ...
- Button 自定义图片,代码绘制样式,添加音效的方法
Button自己在xml文件中绑定监听器 <!-- 设定onclick属性,然后在activity中定义相应的方法 --> <!-- 通过xml布局中通过button的android ...
- 局部响应归一化(Local Response Normalization,LRN)
版权声明:本文为博主原创文章,欢迎转载,注明地址. https://blog.csdn.net/program_developer/article/details/79430119 一.LRN技术介 ...