HTML and CSS Reference
At the end of the function, I return false . That's necessary so that the event handler used
to call the function is stopped. To illustrate what I mean, it's necessary to explain how
this function is called. Instead of using the target attribute in the <a> tag, the onclick
handler is used, as follows:
<a href=“whatever.html” target=”_blank” onclick=“popup('whatever.html')”>Pop
Ordinarily, when a user clicks the link, the browser calls the function and then goes right
back to whatever it was doing before, navigating to the document specified in the href
attribute. Returning false in the popup() function tells the browser not to continue what
it was doing, so the new window is opened by the function, and the browser doesn't fol-
ever.html would still open in a new window because I included the target attribute, too.
In the preceding example, I specified the height and width settings for the new window.
There are several more options available as well, which are listed in Table 17.4.
Settings for Pop-Up Windows
Height of the window in pixels.
Width of the window in pixels.
Enable window resizing.
Display the browser status bar.
Display the browser toolbar.
Display the browser's location bar.
Display the browser's menu bar (Not applicable on Mac OS X.).
Left coordinate of the new window onscreen (in pixels). By
default, pop-up windows are placed slightly to the right of the
Top coordinate of the new window onscreen (in pixels). By
default, pop-up windows are placed slightly below the top of the
When you specify the settings for a window, you must include them in a comma-
separated list, with no spaces anywhere. For the settings that allow you to enable or
disable a browser interface component, the valid values are on or off . Here's a valid list