Popup Windows: open()
Parameters
Until now we've focused on the process of opening and closing the popup window. We'll now shift to the properties of the popup itself. All of the popup's properties are set in the
open()
command. We've used
open()
in every script in this tutorial.
Specifically, the properties of the popup are set in the third argument for open()
which is a list of properties for the popup. Properties are set somewhat similar to the way HTML attributes are set: the name of the property followed by an equal sign followed by the value. Properties are separated by commas. Because of a widespread bug in MSIE, do not put any spaces in the list of properties. The entire list of properties goes inside quotes. So, for example, the following line of code sets
width
to 400
,
height
to 200
, and
turns scrollbars
on.
We'll begin with the width & height properties, which are always required except in
full screen mode. All other properties are optional. Here's a list of popup properties.
width & height |
the dimensions of the popup |
left & top |
the distance from the top and left side of the screen |
toolbar |
if the popup should have a set of navigation buttons across the top |
location |
if the popup should have a location bar where the URL is displayed |
directories |
if the popup should have a row across the top with buttons to
popular web sites |
status |
if the popup should have a status bar across the bottom |
menubar |
if the popup should have a menu |
scrollbars |
if the popup should have scroll bars |
resizable |
if users can resize the popup |
dependent |
if the popup should close when its opener window closes |
full screen |
how to open a full screen popup |
channelmode |
MSIE's channel mode |