HTML DOM Node Trees (Cont.)


The HTML DOM views an HTML document as a node-tree. All the nodes in the tree have relationships to each other.

Node Parents, Children, and Siblings (Cont.)
From the HTML script below:

  • The <html> node has no parent node; it is the root node.
  • The parent node of the <head> and <body> nodes is the <html> node.
  • The parent node of the “Hello world!” text node is the <p> node.
 <html>
  <head>
   <title>DOM Tutorial</title>
  </head>
  <body>
   <h1>DOM Lesson one</h1> 
   <p>Hello world!</p>
  </body>
 </html>

and
First Child and Last Child
From the HTML above:
Demonstration
The following demonstration shows how the script of HTML and JavaScript is displayed on the Web.

     





      My girlfriend told me she was leaving me because    
      I keep pretending to be a Transformer.    
      I said, “No, wait! I can change.”