易截截图软件、单文件、免安装、纯绿色、仅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 location.reload()

功能:
重新加载文档。
语法:
location.reload(force)
参数:
force:可选参数,是一个布尔值。
      如果省略参数,或者参数是false,它就会用HTTP头If-Modified-Since来检测服务器上的文档是否已改变。如果文档已改
变,reload()会再次下载该文档。如果文档未改变,则该方法将从缓存中 ......

[翻译]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 ......

[翻译]High Performance JavaScript(008)

Nested Members  嵌套成员
    Since object members may contain other members, it's not uncommon to see patterns such as window.location.href in JavaScript code. These nested members cause the JavaScript engine to go through the object member resolution process each time a dot is ......

自己写的javascript五子棋

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>five-in-a-raw</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <style>
  ......

XML解析器,自己加了点注释。留底

#include <iostream>
#include "1.h"
int main(int argc, char *argv[])
{
    try
    {
        SXmlDOM dom;
        //dom.parse("<?xml?><书店><书本 书名="VC++" 价格="50" 折扣= ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号