nodeName and nodeValue
In this chapter you will learn:
nodeName and nodeValue Properties
nodeName
and nodeValue
give specific information about the node.
The values of nodeName
and nodeValue
are
dependent on the node type.
<!DOCTYPE HTML> <!-- j av a2s. co m-->
<html>
<body>
<pre id="results"></pre>
<script>
var resultsElement = document.getElementById("results");
document.writeln(resultsElement.nodeType);
document.writeln(resultsElement.nodeName);
</script>
</body>
</html>
For elements, nodeName
is always equal
to the element's tag name, and nodeValue is always null.
Next chapter...
What you will learn in the next chapter: