home HOME

HTML DOM
DOM HOME
DOM Intro
DOM Nodes
DOM Node Tree
DOM Node Access
DOM Node Info
DOM How To
DOM Reference
DOM Summary

DOM Examples
DOM Examples

DOM Objects
DOM Window
DOM Navigator
DOM Screen
DOM History
DOM Location

DOM Document

DOM Anchor
DOM Area
DOM Base
DOM Body
DOM Button
DOM Event
DOM Form
DOM Frame
DOM Frameset
DOM IFrame
DOM Image
DOM Input Button
DOM Input Checkbox
DOM Input File
DOM Input Hidden
DOM Input Password
DOM Input Radio
DOM Input Reset
DOM Input Submit
DOM Input Text
DOM Link
DOM Meta
DOM Object
DOM Option
DOM Select
DOM Style
DOM Table
DOM TableCell
DOM TableRow
DOM Textarea

Selected Reading
Web Statistics
Web Glossary
Web Hosting
Web Quality

W3Schools Forum

Helping W3Schools

pixels

HTML DOM Node Tree

previous next

All the nodes in a node tree have relationships to each other.


Document Tree (Node Tree)

Look at the following HTML document:

<html>
  <head>
    <title>DOM Tutorial</title> 
  </head> 
  <body> 
    <h1>DOM Lesson one</h1> 
    <p>Hello world!</p> 
  </body> 
</html>

All the nodes above have relationships to each other.

Every node except for the document node has a parent node. E.g. the parent node of the <head> and <body> nodes are the <html> node, and the parent node of the "Hello world!" text node is the <p> node.

Most element nodes have child nodes. E.g. the <head> node has one child node: the <title> node. The <title> node also has one child node: the text node "DOM Tutorial".

Nodes are siblings when they share a parent. E.g. the <h1> and <p> nodes are siblings, because their parent is the <body> node.

Nodes can also have descendants. Descendants are all the nodes that are children of a node, or children of those children, and so on. E.g. all text nodes are descendants of the <html> node, while the first text node are descendant of the <head> node.

Nodes can also have ancestors. Ancestors are nodes that are parents of a node, or parents of this parent, and so on. E.g. all text nodes have the <html> node as an ancestor.


previous next

Jump to: Top of Page or HOME or Printer Friendly Printer friendly page

W3Schools provides material for training only. We do not warrant the correctness of its contents. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.

Copyright 1999-2007 by Refsnes Data. All Rights Reserved.

Validate Validate W3C-WAI level A conformance icon W3Schools was converted to XHTML in December 1999