Preview

Definition of the Document Object Model

Good Essays
Open Document
Open Document
549 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Definition of the Document Object Model
The Document Object Model The Document Object Model is a major component of Dynamic Hypertext Markup Language, or DHTML. DHTML is what has allowed web pages to become more interactive over the years. Improved animations, form processing, document manipulation, and online games are all made possible through the use of DHTML. DHTML is primarily composed of JavaScript, XHTML, CSS, and the Document Object Model (DOM). According to Chapter 10 of JavaScript 5th Edition (Gosselin, D. 2011), the DOM “represents the HTML or XML of a Web page that is displayed in a browser.” Therefore there are two aspects of the Document Object Model: HTML DOM and XML DOM. In a nutshell, the DOM is a collection of the HTML or XML elements that are rendered by a browser. To further elaborate let’s take a look at two important objects within the DOM: The Document object and the Image object. The Document object is a collection of methods and properties that are used to control various elements of a web page. All the content that appears on a web page is contained within an element tag and, through the use of the DOM, can be manipulated with JavaScript. The following is a list of methods of the Document object: open() close() getElementsByName() getElementsByTagName() getElementById() write() writeln()

These methods are used to provide interaction between the user and the web page elements. The open() method opens a new document in a window or frame, while the close() method signifies the end of the document. The getElement methods are used to return various HTML element value, and the write() and writeln() methods are used to display content in the document. Now let’s look at the different properties of the Document object: anchors[] body cookie domain forms[] images[] links[] referrer title URL
These properties are used to return the various properties of a document, which can then be controlled with the use of JavaScript. The Document object



References: Gosselin, D. (2011). JavaScript (5th ed.). Boston, MA: Thomson / Course Technology

You May Also Find These Documents Helpful