5. Windows and Frames

In This Chapter

Keeping a Page out of a Frame 117

Setting a Target 118

Loading Iframes with JavaScript 120

Working with Iframes 121

Creating Dynamic Iframes 123

Sharing Functions between Documents 125

Opening a New Window 127

Loading Different Contents into a Window 131

The window is the most important interface element in a Web browser, and as you might expect, JavaScript provides you with many tools to manipulate windows.

JavaScript deals with windows similarly to the way it deals with frames. This makes perfect sense, since frames are just other document windows within the overall browser window.

However, frames have fallen out of favor over the past few years—to the point that (except for iframes) they’ve been removed ...

Get JavaScript: Visual QuickStart Guide, Eighth 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.