-
Many JavaScript objects are contained within each other.
-
JavaScript objects have a container to contained object relationship rather than a class and subclass relationship.
-
Properties are not inherited from one type of object to another.
There are two main types of JavaScript objects.
-
Language Objects : Objects provided by the language and are not dependent on other objects.
-
Navigator Objects : Objects provided by the client browser. These objects are all sub objects to the navigator object.

-
The programming interface to the HTML objects appearing on a Web page is known as the Document Object Model (DOM).
-
The DOM supplies the properties and methods associated with HTML elements and defines how these properties are set and how these methods are activated to effect changes in the elements.
-
More broadly, the DOM is the full collection of browser components both surrounding and comprising a Web page, including the browser itself and its component windows, frames, documents, forms, and HTML elements.
-
All of these browser components are programmable through the DOM.

Identifying DOM Objects
-
In order to program DOM objects, they must be identified to the scripts that manipulate their properties and methods.
-
The following table summarizes several of the references used within scripts to identify common DOM objects.
Refernces |
Object |
navigator |
The browser itself. |
window |
The main browser window. |
window.framename |
A frame that occupies the browser window and identified by its assigned name. |
window.document |
The document appearing in the main browser window. |
window.framename.document |
The document appearing in a frame identified by its assigned name. |
document.getElementById(“id”) |
An XHTML element appearing in a document and identified by its assigned id value. |
DOM Components, Properties, and Methods
-
There are literally hundreds of property settings that can be applied to elements on a Web page; there are dozens of methods.
-
In addition, there are properties and methods associated with the browser itself, with its windows and frames, with the documents appearing inside windows and frames, and with other components of the Document Object Model.
-
Note:- that an object is just a special kind of data. An object has properties and methods.
Properties :- Properties are the values associated with an object.
<script type="text/javascript">
var txt="Hello World!"
document.write( txt.length )
</script>
Methods :- Methods are the actions that can be performed on objects.
<script type="text/javascript">
var str="Hello India!"
document.write( str.toUpperCase() )
</script>
Recent Comments