An Introduction to the DOM
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.
This site needs an editor - click to learn more!
Editor's Picks Articles
Top Ten Articles
Content copyright © 2018 by Elizabeth Connick. All rights reserved.
This content was written by Elizabeth Connick. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.