Chapter 10. Window and Document Objects
IN THIS CHAPTER
What the window object does
How to access key window object properties and methods
How to trigger script actions after a document loads
The purposes of the location and navigator objects
How the document object is created
How to access key document object properties and methods
Now that you have exposure to programming fundamentals, it is easier to demonstrate how to script objects in documents. Starting with this lesson, the tutorial turns back to the Document Object Model (DOM), diving more deeply into the objects you will place in many of your documents.
As a refresher, study the hierarchy of top-level objects in Figure 10-1. This chapter focuses on objects of this level that you'll frequently encounter in your scripting:
window, location, navigator, and
document. The goal is not only to equip you with the basics so you can script simple tasks, but also to prepare you for the in-depth examinations of each object and its properties, methods, and event handlers, that you will find in Part IV, "Document Objects Reference." We introduce only the basic properties, methods, and events for objects in this tutorial. Examples in Part IV of the book assume that you know the programming fundamentals covered here in Part II.
The window Object
At the top of the object hierarchy is the
window object. This object gains that exalted spot in the object food chain because it is the master container for all content you view in the web ...