The DOM model and Javascript

The Document Object Model (or DOM model for short) is used to identify the various objects or elements in a web page and how they are related to the web page itself. The DOM model is used to interact with objects and elements on a webpage when developing it and is used by virtually all popular web programming languages which comprises of XML and HTML among others.

The DOM model can be accessed and used based on language specific syntax, i.e. referring to the DOM model in HTML differs from referring to it in PHP. The DOM model also has prewritten libraries to comprehensively interact with different aspects of a web page. The DOM model is also widely used in developing Javascript code and was in fact partly created for interactivity with web pages using Javascript. Several versions of the DOM were created to enhance functionality namely the Legacy DOM (first developed to be used with Javascript) and the intermediate DOM, it was later standardized to a common syntax to work on all standard browsers by the World Wide Web consortium.

The DOM model is used to get or set values to different visual aspects on a web page in Javascript. Here are some basic syntax used to represent certain parts of your interface using DOM in Javascript:

There are several other methods and properties used to represent parts of a webpage. Javascript is the only language that is entirely dependant on the DOM to function. HTML, Perl and other languages can be written utilizing the DOM but pages can still be displayed without rendering the DOM part of the HTML code, this is not true with Javascript. Thus the DOM is an integral part of Javascript.