Changes

JavaScript Window Object

795 bytes added, 14:51, 9 May 2007
Referencing the JavaScript Window Object
== Referencing the JavaScript Window Object ==
 
As covered in [[JavaScript Object Basics]] it is usually necessary to use dot-notation when accessing properties or methods of an object. For example the following script fragment accesses the ''write()'' method of the ''document'' object:
 
<pre>
document.write("Hello");
</pre>
 
The window object is the top-level object of the object hierarchy and as such, whenever an object method or property is referenced in a script with the object name and dot prefix it is assumed by JavaScript to be a member of the window object. This means, for example, that when calling the window ''alert()'' method to display an alert dialog the ''window.'' prefix is not mandatory. Therefore the following method calls achive the same thing:
 
window.alert();
alert()
 
== Opening and Closing Browser Windows ==