⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dom_examples.asp@output=print

📁 W3Schools tutorial..web designing
💻 ASP@OUTPUT=PRINT
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>XML DOM Examples</title>
 
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />

<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

</head>
<body>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>


<h1>XML DOM Examples</h1>

<a href="dom_summary.asp"><img border="0" src="../images/btn_previous.gif" alt="prev" width="100" height="20" /></a>
<a href="dom_validate.asp"><img border="0" src="../images/btn_next.gif" alt="next" width="100" height="20" /></a>

<hr />

<p><b>XML DOM Parsing</b></p>
<p>The examples below use the XML file <a target="_blank" href="books.xml">
books.xml</a>. </p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_parser">Load and parse an 
XML file</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_parser2">Load and parse an 
XML string</a></p>
<p><a class="example" href="dom_parser.asp">Examples explained</a></p>
<hr />

<p><b> XML DOM Properties and Methods</b></p>
<p>The examples below use the XML file <a target="_blank" href="books.xml">
books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external 
JavaScript is used to load the XML file.<br />
A function, <a href="dom_loadxmldoc.asp">loadXMLString()</a>, in an external 
JavaScript is used to load the XML string.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_parsertest">Load and 
parse an XML file - External parsing script</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_parsertest2">Load and parse 
an XML string - External parsing script</a></p>
<p><a class="example" href="dom_methods.asp">Examples explained</a></p>
<hr />

<p><b> XML DOM Accessing Nodes</b></p>
<p>The examples below use the XML file <a target="_blank" href="books.xml">
books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external 
JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_index">Access a node using its index number in a node list</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_list_loop">Loop through nodes using the length property</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_root">See the node type of an element</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_loop">Loop through element nodes</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_navigate">Loop through element nodes using node relationships</a></p>
<p><a class="example" href="dom_nodes_access.asp">Examples explained</a></p>
<hr />

<p><b> XML DOM Node Information</b></p>
<p>The examples below use the XML file <a target="_blank" href="books.xml">
books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external 
JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_nodename3">Get the node name of an element node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_getelement">Get the text from a text node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_changeelement">Change the text in a text node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_root">Get the node name and type of an element node</a></p>
<p><a class="example" href="dom_nodes_info.asp">Examples explained</a></p>
<hr />

<p><b> XML DOM Node List and Attribute List</b></p>
<p>The examples below use the XML file <a target="_blank" href="books.xml">
books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external 
JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_nodelist">Get the text 
from the first &lt;title&gt; element</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_nodelist_length">Loop 
through nodes using the length property</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_attributes">Get the 
attribute of an element</a></p>
<p><a class="example" href="dom_nodes_nodelist.asp">Examples explained</a></p>
<hr />

<p><b> XML DOM Traversing Node Tree</b></p>
<p>The examples below use the XML file <a target="_blank" href="books.xml">
books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLString()</a>, in an external 
JavaScript is used to load the XML string.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_parsertest3">Traverse a 
node tree</a></p>
<p><a class="example" href="dom_nodes_traverse.asp">Examples explained</a></p>
<hr />

<p><b> XML DOM Browser Differences</b></p>
<p>The examples below use the XML file <a target="_blank" href="books.xml">
books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external 
JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_nodetype_ievsmozilla">
Display the length of a node list - Different results in IE and other browsers</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_nodetype_ievsmozilla2">
Ignore empty text between nodes</a></p>
<p><a class="example" href="dom_mozilla_vs_ie.asp">Examples explained</a></p>
<hr />

<p><b> XML DOM Navigating Nodes</b></p>
<p>The examples below use the XML file <a target="_blank" href="books.xml">
books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external 
JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_nav_parentnode">Get the 
parent of a node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_nav_firstchild">Get the 
first child element of a node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_nav_lastchild">Get the last 
child element of a node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_nav_nextsibling">Get the 
next sibling element of a node</a>&nbsp;<br />
<a target="_blank" href="tryit.asp@filename=try_dom_nav_prevsibling">Get the 
previous sibling element of a node</a></p>
<p><a class="example" href="dom_nodes_navigate.asp">Examples explained</a></p>
<hr />

<p><b>XML DOM Get Node Values</b></p>

<p>The examples below use the XML file
<a target="_blank" href="books.xml">books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_getelementsbytagname">Get 
an element's text value</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_getattribute">Get an 
attribute's text value</a></p>
<p><a class="example" href="dom_nodes_get.asp">Examples explained</a></p>
<hr />

<p><b>XML DOM Change Node Values</b></p>

<p>The examples below use the XML file
<a target="_blank" href="books.xml">books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_change_nodevalue">Change 
an elements text node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_setattribute1">Change an 
attributes value using setAttribute</a><br />
<a href="tryit.asp@filename=try_dom_att_nodevalue">Change an attributes value 
using nodeValue</a></p>
<p><a class="example" href="dom_nodes_set.asp">Examples explained</a></p>
<hr />

<p><b>XML DOM Remove Nodes</b></p>

<p>The examples below use the XML file
<a target="_blank" href="books.xml">books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_removechild">Remove an 
element node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_removecurrent">Remove the 
current element node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_removetextnode">Remove a 
text node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_remove_nodevalue">Clear the 
text of a text node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_removeattribute">Remove an 
attribute by name</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_removeattributenode">Remove 
attributes by object</a></p>
<p><a class="example" href="dom_nodes_remove.asp">Examples explained</a></p>
<hr />

<p><b>XML DOM Replace Nodes</b></p>

<p>The examples below use the XML file
<a target="_blank" href="books.xml">books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_replacechild">Replace an 
element node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_replacedata2">Replace data 
in a text node</a></p>
<p><a class="example" href="dom_nodes_replace.asp">Examples explained</a></p>
<hr />

<p><b>XML DOM Create Nodes</b></p>

<p>The examples below use the XML file
<a target="_blank" href="books.xml">books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_createelement1">Create an 
element node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_createattribute">Create an 
attribute node using createAttribute </a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_createattribute3">Create an 
attribute node using setAttribute </a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_createelement1">Create a 
text node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_createcdatasection1">Create 
a CDATA section node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_createcomment1">Create a 
comment node</a></p>
<p><a class="example" href="dom_nodes_create.asp">Examples explained</a></p>
<hr />

<p><b>XML DOM Add Nodes</b></p>

<p>The examples below use the XML file
<a target="_blank" href="books.xml">books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_createelement2">Add a 
node after the last child node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_insertbefore">Add a node 
before a specified child node</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_createattribute3">Add a new 
attribute</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_insertdata">Add data to a 
text node</a></p>
<p><a class="example" href="dom_nodes_add.asp">Examples explained</a></p>
<hr />

<p><b>XML DOM Clone Nodes</b></p>

<p>The examples below use the XML file
<a target="_blank" href="books.xml">books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_clonenode">Copy a node 
and append it to an existing node</a></p>
<p><a class="example" href="dom_httprequest.asp">Examples explained</a></p>
<hr />

<p><b>XML DOM Clone Nodes</b></p>

<p>The examples below use the XML file
<a target="_blank" href="books.xml">books.xml</a>. <br />
A function, <a href="dom_loadxmldoc.asp">loadXMLDoc()</a>, in an external JavaScript is used to load the XML file.</p>
<p><a target="_blank" href="tryit.asp@filename=try_dom_httpsuggest">XML HTTP 
communication with a server while typing input</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_httprequest_js1">Load a 
textfile into a div element with XML HTTP</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_httprequest_js2">Make a HEAD 
request with XML HTTP</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_httprequest_js3">Make a 
specified HEAD request with XML HTTP</a><br />
<a target="_blank" href="tryit.asp@filename=try_dom_httprequest_js4">List data 
from an XML file with XML HTTP</a></p>
<p><a class="example" href="dom_nodes_clone.asp">Examples explained</a></p>
<hr />

<a href="dom_summary.asp"><img border="0" src="../images/btn_previous.gif" alt="prev" width="100" height="20" /></a>
<a href="dom_validate.asp"><img border="0" src="../images/btn_next.gif" alt="next" width="100" height="20" /></a>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -