![]() |
IPVNN Web Tutorials - Full Web Building Tutorials, All FREE ! |
| HTML DOM DOM HOME DOM Intro DOM Nodes DOM Node Tree DOM Methods DOM Node Access DOM Node Info DOM How To DOM Events DOM Summary DOM Objects |
HTML DOM NodesIn the DOM, everything in an HTML document is a node. DOM NodesAccording to the DOM, everything in an HTML document is a node. The DOM says:
DOM ExampleLook at the following HTML document:
The root node in the HTML above is <html>. All other nodes in the document are contained within <html>. The <html> node has two child nodes; <head> and <body>. The <head> node holds a <title> node. The <body> node holds a <h1> and <p> node. Text is Always Stored in Text NodesA common error in DOM processing is to expect an element node to contain text. However, the text of an element node is stored in a text node. In this example: <title>DOM Tutorial</title>, the element node <title>, holds a text node with the value "DOM Tutorial". "DOM Tutorial" is not the value of the <title> element! However, in the HTML DOM the value of the text node can be accessed by the innerHTML property. You can read more about the innerHTML property in a later chapter. |
|