The DOM is best known among web developers for its ability to dynamically alter the structure and content of web pages using easily implemented scripting techniques. JavaScript contains a useful (although somewhat restricted) set of built-in methods for accessing, manipulating, and even replacing DOM nodes.
Nodes are a fundamental part of the DOM; each object in the DOM is represented as a node. Each node may be a branch node, which has child nodes and possibly parent nodes and sibling nodes, or it may be a leaf node, which may have siblings and parents but not children of its own.
In the previous screenshot, you can clearly see that the page is made up of a series of objects, where each individual object is a node. The nodes shown in that example are branch nodes because each one has at least one child. The HTML node, for example, has HEAD and BODY child nodes, and both of these have their own child nodes.
A special node is the document node, commonly...