O'Reilly logo

Dynamic HTML: The Definitive Reference by Danny Goodman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

open( ) — NN 2 IE 3 DOM n/a

Synopsis

open(URL, windowName[, windowFeatures])

Opens a new window (without closing the original one). You can specify a URL to load into that window or set that parameter to an empty string to allow scripts to document.write( ) into that new window. The windowName parameter lets you assign a name that can be used by TARGET attributes. This name is not to be used in script references as frame names are. Instead, a script reference to a subwindow must be to the window object returned by the window.open( ) method. Therefore, if your scripts must communicate with a window opened in this manner, it is best to save the returned value as a global variable so that future statements can use it.

A potential problem with subwindows is that they can be buried under the main window if the user clicks on the main window (or a script gives it focus). Any script that opens a subwindow should also include a focus( ) method for the subwindow (in Navigator 3 and later, and in IE 4 and later) to make sure it comes to the front in case it is already open. Subsequent invocations of the window.open( ) method whose windowName parameter is the same as an earlier call automatically address the previously opened window, even if it is underneath the main window.

The optional third parameter gives you control over various physical attributes of the subwindow. The windowFeatures parameter is a single string consisting of a comma-delimited list (without spaces between items) of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required