Opens a new Web browser window.

Syntax

JSV_popWindow(winHandle, winName, winURL, winAttributes, winReplace)

Returns

Returns the window handle—the result of the open() method that is a reference or handle to the newly opened window and used to close the window, and to interrogate and alter the windows properties.

Parameters

The JSV_popWindow function uses the following arguments.

Argument Description
winHandle The result of the open method that is returned and held in this variable (see Remarks below). This is a reference or handle to the newly opened window. The window handle can be used to close the window, and to interrogate and alter the windows properties.
winName This is the target name of the new window. A string specifying the window name to use in the TARGET attribute of a FORM or A tag. winName can contain only alphanumeric or underscore (_) characters.
winURL Optional. A string specifying the relative or absolute URL of the file to be loaded into the pop-up window. See the Location object for a description of the URL components.
winAttributes

Optional. A string containing a comma-separated list determining whether or not to create various standard window features. See JSV_openWindow for a list of these attributes.

winReplace Optional. The fourth parameter is a Boolean value, either true (set this to true only if using Navigator 3+ or Internet Explorer 4+) or false. If true, then the current history entry is replaced with the new page being loaded (i.e., the last location in the browser's history object is overwritten by the new location). Default value is false.

Remarks

See open in the Client-Side JavaScript Reference.

The window handle should be initialized to null, and made a global variable for it to persist as long as the page is in the browser, or to be used by functions.

Subsequent calls to JSV_popWindow with the winHandle, winURL and winReplace on a window that is already open, loads the passed URL into the window conventionally, or replaces the current page with the passed URL if winReplace is true.

Dependencies

n/a

Example

The following lines of code

var myWindowHandle = null;
var myWindow = "JSV_Test";
var myAttributes = 'status=1,scrollbars=1,resizable=1,width=580,height=240,left=40,top=40,screenX=40,screenY=40';

function windowTest() {
    myWindowHandle = JSV_popWindow(myWindowHandle, myWindow, 'testpage.htm', myAttributes, false);
    if (window.focus) myWindowHandle.focus();
}

function windowTest2() {
    myWindowHandle = JSV_popWindow(myWindowHandle, myWindow, 'testpage2.htm', myAttributes, false);
    if (window.focus) myWindowHandle.focus();
}

produce a new window when one of these buttons are clicked