This is a sample paragraph.Introduction to the Document Object Model The Document Object Model, or DOM, is the interface that allows you to programmatically access and manipulate the contents of a web page (or document). It provides a structured, object-oriented representation of the individual elements and content in a page with methods for retrieving and setting the properties of those objects. It also provides methods for adding and removing such objects, allowing you to create dynamic content.

NodeA.firstChild = NodeA1 NodeA.lastChild = NodeA3 NodeA.childNodes.length = 3 NodeA.childNodes[0] = NodeA1 NodeA.childNodes[1] = NodeA2 NodeA.childNodes[2] = NodeA3 NodeA1.parentNode = NodeA NodeA1.nextSibling = NodeA2 NodeA3.prevSibling = NodeA2 NodeA3.nextSibling = null NodeA.lastChild.firstChild = NodeA3a NodeA3b.parentNode.parentNode = NodeA The Node interface also provides methods for dynamically adding, updating and removing nodes such as: insertBefore() replaceChild() removeChild() appendChild() cloneNode() This interface provides methods for accessing and creating other nodes in the document tree. Some methods are: getElementById() getElementsByTagName() createElement() createAttribute() createTextNode()

This is a sample paragraph.

and this code: alert(document.documentElement.lastChild.firstChild.tagName); which would display 'P', the name of the tag represented by that node. The code breaks down as follows: document.documentElement - gives the page's HTML tag. .lastChild - gives the BODY tag. .firstChild - gives the first element in the BODY. .tagName - gives that element's tag name, 'P' in this case.