What is the Document Object Model?

Article Details
  • Written By: Vanessa Harvey
  • Edited By: A. Joseph
  • Last Modified Date: 04 November 2019
  • Copyright Protected:
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
People with auto-brewery syndrome convert carbs into ethanol in their gut, becoming drunk without drinking alcohol.  more...

November 13 ,  1956 :  The US Supreme Court upheld a decision that ended public bus segregation in Montgomery, Alabama.  more...

The document object model (DOM) is a visual representation of a hierarchical template, or map, of all of the objects and properties that are contained in a web document and that can be recognized by a web browser. This browser object model also specifies the various methods or actions available to a programmer that can be performed on or with the objects. The document object model is a representation of programming or, more precisely, scripting possibilities. Although major browsers support a generic DOM, the scripts that work in one browser might not be functional in another. Programmers can, however, safely work with the objects, properties and methods according to a basic DOM that is common to all major Internet browsers.

Web documents appear to be only a single unit within a browser window, but they actually are composed of a variety of objects. They can and often do contain many properties, and they behave in different ways because of the variety of methods that a programmer can apply to the objects of the document. For example, images can appear in a document and are considered to be objects within the document, which is itself an object.


Links also are objects on which programmers can use methods or perform actions, such as having the color of links change when the mouse is hovered over them or having an image appear or change. DOM scripting involves coding or writing small computer programs known as scripts that are embedded into web documents. These scripts add functionality to web pages, including but not limited to the validation of forms, virtual calculators, pop-up messages, simple games, quizzes and even animation.

Programmers create code according to the possibilities of the document object model with which they work, unless they choose to code very conservatively using a generic DOM to avoid the possibility of browser compatibility problems. The document object model is of importance to programmers who write what are known as client side scripts in web development. Web documents are stored on a web server that delivers the pages to the client computer that requested them and that presents them visually to the website visitor via a browser. Scripts embedded in the web pages stored on the web server must run on the client computer according to the document object model of the browser of that client computer.


You might also Like


Discuss this Article

Post your comments

Post Anonymously


forgot password?