The Window Object

In the previous code in this chapter we’ve already used many parts of the Window object. The Alert method, the Location object, and the Document object and its descendants are all subordinate to the grand-daddy of them all, the Window object.

The table below shows the properties, methods, and events supported by the Window object. The entries in the Properties column that include the string (object) are objects in themselves, accessible through the Window object.

Properties Methods Events
name alert onLoad
parent confirm onUnload
opener prompt
self open
top close
location (object) setTimeout
defaultStatus clearTimeout
status navigate
frames (object)
history (object)
navigator (object)
document (object)

We’ll leave the descendant objects for now, and concentrate on the rest of the Window object—don’t worry, there’s plenty to keep us occupied for a while. In the following examples, we’ll explicitly use the current Window object for the sake of clarity. Don’t forget that, since Window is the default object on the page, most code will work identically without a qualifying Window prefix (note that we always have to use it when declaring an event handler like Window_onLoad).

© 1997 by Wrox Press. All rights reserved.