Opening a New Window

You’ll often want to create new windows to show users additional information without losing the information that they are reading. For example, you could open up an annotation window for a technical paper or for a news story. Although it is possible to open a new browser window with HTML, using JavaScript gives you more control over the new window’s content and features. Figure 6.1 shows you a standard browser window with all the parts labeled. You can create windows that have any or all of these parts. Script 6.1 shows the HTML, and Script 6.2 shows the JavaScript that creates a window from a page (Figure 6.2) where clicking a link brings up a new window (that contains an image of our cat, in this example).

Figure 6.1. ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, 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.