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

📄 dom_nodes_info.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>HTML DOM Node Information</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>HTML DOM Node Information</h1>
<a href="dom_nodes_access.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" /></a>
<a href="dom_using.asp"><img border="0" alt="next" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />

<p class="intro">The nodeName, nodeValue, and nodeType properties contain 
information about nodes.</p>

<hr />

<h2>Node Properties</h2>
<p>In the HTML Document Object Model (DOM), each node is an <b>object</b>.</p>
<p>Objects have methods (functions) and properties (information about the 
object), that can be accessed and manipulated by JavaScript.</p>
<p>Three important HTML DOM node properties are:</p>
<ul>
	<li>nodeName</li>
	<li>nodeValue</li>
	<li>nodeType</li>
</ul>

<hr />

<h2>The nodeName Property</h2>
<p>The nodeName property specifies the name of a node.</p>
<ul>
	<li>nodeName is read-only</li>
	<li>nodeName of an element node is the same as the tag name</li>
	<li>nodeName of an attribute node is the attribute name</li>
	<li>nodeName of a text node is always #text</li>
	<li>nodeName of the document node is always #document</li>
</ul>
<p><b>Note:</b> nodeName always contains the uppercase tag name of an HTML 
element.</p>
<p><a target="_blank" href="../dom/tryit.asp@filename=try_dom_nodename3">Try it 
yourself.</a></p>

<hr />

<h2>The nodeValue Property</h2>
<p>The nodeValue property specifies the value of a node.</p>
<ul>
	<li>nodeValue for element nodes is undefined</li>
	<li>nodeValue for text nodes is the text itself</li>
	<li>nodeValue for attribute nodes is the attribute value</li>
</ul>
<hr  />
<h2><b>Example1: Get the Value of an Element</b></h2>
<p>The following code fragment retrieves the text node value of the first &lt;p&gt; 
element:</p>
<table class="ex" id="table31" border="1" cellspacing="0" width="100%">
	<tr>
		<td>
		<pre>x=document.getElementById(&quot;intro&quot;).firstChild;
txt=x.nodeValue;</pre>
		</td>
	</tr>
</table>
<p>Result:&nbsp; txt = &quot;W3Schools example&quot;</p>
<p>Example explained:</p>
<ol>
	<li>Get text node of the first &lt;p&gt; element node</li>
	<li>Set the txt variable to be the value of the text node</li>
</ol>
<p><a target="_blank" href="../js/tryit.asp@filename=try_dom_tut_nodevalue">Try it 
yourself</a></p>
<hr  />
<h2>The nodeType Property</h2>
<p>The nodeType property returns the type of node.</p>
<p>nodeType is read only.</p>
<p>The most important node types are:</p>

<table border="1" width="100%" class="ex" cellspacing="0" id="table1">
<tr>
<th width="85%" align="left" valign="top">Element type</th>
<th width="15%" align="left" valign="top">NodeType</th>
</tr>
<tr>
	<td valign="top">Element</td>
	<td valign="top">1</td>
</tr>
<tr>
	<td valign="top">Attribute</td>
	<td valign="top">2</td>
</tr>
<tr>
	<td valign="top">Text</td>
	<td valign="top">3</td>
</tr>
<tr>
	<td valign="top">Comment</td>
	<td valign="top">8</td>
</tr>
<tr>
	<td valign="top">Document</td>
	<td valign="top">9</td>
</tr>
</table>

<br />

<hr />
<a href="dom_nodes_access.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="dom_using.asp"><img border="0" alt="next" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />

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

</body>
</html>

⌨️ 快捷键说明

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