怎么建立XMLHttpRequest对象
本篇内容主要讲解“怎么建立XML HttpRequest对象”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“怎么建立XML HttpRequest对象”吧!
创新互联建站是一家以网络技术公司,为中小企业提供网站维护、成都做网站、网站制作、成都外贸网站建设、网站备案、服务器租用、域名与空间、软件开发、成都微信小程序等企业互联网相关业务,是一家有着丰富的互联网运营推广经验的科技公司,有着多年的网站建站经验,致力于帮助中小企业在互联网让打出自已的品牌和口碑,让企业在互联网上打开一个面向全国乃至全球的业务窗口:建站联系热线:028-86922220
utl.js
代码如下:
function createXmlTree(node, indent) {
if (node == null)
return "";
var str = "";
switch (node.nodeType) {
case 1: // Element
str += "
var attrs = node.attributes;
for (var i = 0; i < attrs.length; i++)
str += createXmlAttribute(attrs[i]);
if (!node.hasChildNodes())
return str + "/>
str += ">
";
var cs = node.childNodes;
for (var i = 0; i < cs.length; i++)
str += createXmlTree(cs[i], indent + 3);
str += "</" + node.nodeName + ">
break;
case 9: // Document
var cs = node.childNodes;
for (var i = 0; i < cs.length; i++)
str += createXmlTree(cs[i], indent);
break;
case 3: // Text
if (!/^\s*$/.test(node.nodeValue))
str += "" + node.nodeValue + "
";
break;
case 7: // ProcessInstruction
str += "<?" + node.nodeName;
var attrs = node.attributes;
for (var i = 0; i < attrs.length; i++)
str += createXmlAttribute(attrs[i]);
str+= "?>
"
break;
case 4: // CDATA
str = "
node.nodeValue +
"]" + "]>
break;
case 8: // Comment
str = "
node.nodeValue +
"-->
break;
case 10:
str = "
if (node.publicId) {
str += " PUBLIC \"" + node.publicId + "\"";
if (node.systemId)
str += " \"" + node.systemId + "\"";
}
else if (node.systemId) {
str += " SYSTEM \"" + node.systemId + "\"";
}
str += ">
// TODO: Handle custom DOCTYPE declarations (ELEMENT, ATTRIBUTE, ENTITY)
break;
default:
//alert(node.nodeType + "\n" + node.nodeValue);
inspect(node);
}
return str;
}
function inspect(obj) {
var str = "";
for (var k in obj)
str += "obj." + k + " = " + obj[k] + "\n";
window.alert(str);
}
function createXmlAttribute(a) {
return " " + a.nodeName + "=\"" + a.nodeValue + "\"";
}
代码如下:
rel=stylesheet>
value=xtree.xsl>xtree.xsl
代码如下:
HTML {
BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px
}
BODY {
BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px
}
BODY {
BACKGROUND: buttonface; FONT: Message-Box
}
FORM {
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px
}
FIELDSET FIELDSET {
MARGIN: 5px
}
BUTTON {
MARGIN-LEFT: 5px
}
TEXTAREA {
WIDTH: 100%; HEIGHT: 200px
}
#out {
BORDER-RIGHT: threeddarkshadow 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: threeddarkshadow 1px solid; MARGIN-TOP: 5px; PADDING-LEFT: 3px; BACKGROUND: white; PADDING-BOTTOM: 3px; BORDER-LEFT: threeddarkshadow 1px solid; COLOR: black; PADDING-TOP: 3px; BORDER-BOTTOM: threeddarkshadow 1px solid; FONT-FAMILY: Verdana
}
#srcTextContainer {
DISPLAY: none
}
.element {
PADDING-LEFT: 16px; COLOR: blue
}
.elementname {
COLOR: darkred
}
.attribname {
COLOR: red
}
.attribvalue {
COLOR: blue
}
.text {
PADDING-LEFT: 16px; COLOR: windowtext
}
.cdata-content {
DISPLAY: block; PADDING-LEFT: 16px; BORDER-LEFT: gray 1px solid; COLOR: windowtext; FONT-FAMILY: Courier New; WHITE-SPACE: pre
}
.comment {
PADDING-LEFT: 16px; COLOR: blue
}
.doctype {
PADDING-LEFT: 16px; COLOR: blue
}
.comment-content {
DISPLAY: block; COLOR: gray; FONT-FAMILY: Courier New; WHITE-SPACE: pre
}
#XMLDebug {
BORDER-RIGHT: #000 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: #000 1px solid; MARGIN-TOP: 6px; PADDING-LEFT: 4px; FONT-SIZE: 12px; BACKGROUND: #fff; PADDING-BOTTOM: 4px; OVERFLOW: auto; BORDER-LEFT: #000 1px solid; PADDING-TOP: 4px; BORDER-BOTTOM: #000 1px solid; HEIGHT: 400px
}
到此,相信大家对“怎么建立XML HttpRequest对象”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
网站标题:怎么建立XMLHttpRequest对象
网页地址:http://cdiso.cn/article/igejgi.html