Chapter 27. Window and Frame Objects

IN THIS CHAPTER

  • Scripting communication among multiple frames

  • Creating and managing new windows

  • Controlling the size, position, and appearance of the browser window

  • Details of window, frame, frameset, and iframe objects

A quick look at the basic document object model diagram in Chapter 25, "Document Object Model Essentials," (refer to Figure 25-1) reveals that the window object is the outermost global container of all document-related objects that you script with JavaScript. All HTML and JavaScript activity takes place inside a window. That window may be a standard Windows, Mac, or XWindows application-style window, complete with scroll bars, toolbars, and other chrome; you can also generate windows that have only some of a typical window's chrome. A frame is also a window, even though a frame doesn't have many accoutrements beyond scroll bars. The window object is where everything begins when JavaScript references objects. Modern browsers treat the frameset as a special kind of window object, so it is also covered in this chapter.

Of all the objects associated with browser scripting, the window and window-related objects have by far the most object-specific terminology associated with them. This necessitates a rather long chapter to keep the whole discussion in one place.

Window Terminology

The window object is often a source of confusion when you first learn about the document object model. A number of synonyms for window objects muck up the works: ...

Get JavaScript® Bible, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.