Guest Author - Elizabeth Connick
DOM is an acronym for Document Object Model. It's a way of looking at HTML that makes it possible for website developers to create functions and manipulate the code in ways that would otherwise be impossible.
There are three basic types of DOM; the core DOM, which can be used to define any document regardless of type; the XML DOM, which is used with XML documents, and the HTML DOM. This last type is the most important and useful for HTML developers, so that's the DOM this article will explore.
As you already know, an HTML page is composed of different elements like this:
<title>Sample HTML Page</title>
<p id="sample">This is an example of a basic HTML page.</p>
With the DOM, each element (everything between one set of tags, such as <html></html>) is a node. The <html> node is called the root node, and is the most basic; it has two child nodes, the <head> node and the <body> node. In the above example, the <title> node is the child of the <head> node and the <p> node is the child of the <body> node.
A web developer can use and alter the DOM by using certain commands. These commands are divided into properties (which describe a portion of the HTML page) and methods (which do something to that portion of the page).
For specifics on how to use the HTML DOM, see the next article, "Working with the DOM," which will be posted next week.