The Document Object Model
HTML and JavaScript are very different languages. One is a declarative markup language and the other object-oriented scripting language. Yet the two languages work together, thanks in large part to the Document Object model.
The Document Object Model (DOM) is a programming interface for HTML documents, like a web page. It provides a representation of the page so that programs can change the document structure style and content. Typically, these programs are written in JavaScript.
Because all modern browsers have implemented a variation of the DOM standard, there are no special requirements needed to start using the DOM, and many of the commonly used commands are supported by a majority of the browsers. When working with the DOM, the document
and window
elements are immediately available to manipulate the document and its children.
Some of the properties we can access of the document
object are:
Property | Description |
---|---|
document.title | Contains the title of the current document |
document.lastModified | Contains the date when the document was last modified |
document.URL | Contains the URL of the current document |
document.domain | Contains the domain of the current document |
document.cookie | Contains a list of all the cookies for the document |
document.forms | Contains the list of all the forms in the document |
document.images | Contains a list of all the images in the document |
document.links | Contains the list of all the links in the document |
This YouTube video was created by Steve Griffith.