易截截图软件、单文件、免安装、纯绿色、仅160KB

javascript跨浏览器创建XML对象


var
 
xmlDoc
 
=
 
null
;
function
 
parseXML
(
xmlUrl
)
{
  try
 
{
    //IE
    xmlDoc
 
=
 
new
 
ActiveXObject
(
"Microsoft.XMLDOM"
);
    xmlDoc
.
async
 
=
 
false
;
    xmlDoc
.
load
(
xmlUrl
);
  }
catch
(
e
)
  {
    try
{
    //
Firefox

Mozilla

Opera

etc
.
    xmlDoc
 
=
 
document
.
implementation
.
createDocument
(
""
,
""
,
null
);
    xmlDoc
.
async
 
=
 
false
;
    xmlDoc
.
load
(
xmlUrl
);
    }
catch
(
e
)
    {
      try
{
        //
google
,
Safari
       
var
 
xmlhttp
 
=
 
new
 
window
.
XMLHttpRequest
();
        xmlhttp
.
open
(
"GET"
,
xmlUrl
,
false
);
        xmlhttp
.
send
(
null
);
        xmlDoc
 
=
 
xmlhttp
.
responseXML
.
documentElement
;
      }
catch
(
e
){
alert
(
e
.
message
+
"  EROR"
);
return
;}
    }
  }
}


相关文档:

通过javascript获得url参数

页面提交数据一般有两种方法:get,post。post就是所谓的form提交,使用视图;get是通过url提交。
Get方法一般用后台代码(如asp,asp.net)获得参数,代码很简单:Request.QueryString["id"];即可获取。 
有些时候需要直接在前台获取url参数,要用到javascript,js没有直接获取url参数的方法,那么,我们如何通过js ......

[读书笔记][JavaScript高级程序设计]

第二章:ECMAScript基础
1.当函数无明确返回值时,返回的也是值undefined
  function testFunc(){}
  alert(testFunc()==undefined);
2.typeof(null)=='object' //true,null可以解释为对象占位符
3.undefined 是声明了变量但未对其初始化时赋予该变量的值,null则用于表示尚未存在的对象。
  alert(nu ......

[翻译]High Performance JavaScript(007)

Dynamic Scopes  动态作用域
    Both the with statement and the catch clause of a try-catch statement, as well as a function containing eval_r(), are all considered to be dynamic scopes. A dynamic scope is one that exists only through execution of code and therefore cannot be det ......

Linq to XML customize distinct function

Definition comparer class,
class ItemComparer : IEqualityComparer<XElement>
{
public bool Equals(XElement x, XElement y)
{
return x.Attribute("Name").Value == x.Attribute("Name").Value;
}
public int GetHashCode(XElement obj)
......

javascript cookies 存、取、删除实例

<script>
//写cookies函数 作者:翟振凯
function
SetCookie(name,value)//两个参数,一个是cookie的名子,一个是值
{
    var Days = 30;
//此 cookie 将被保存 30 天
    var exp  = new Date();    //new
Date("December 31, 9998");
    ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号