See also: JSV_getWindowDeltas, JSV_getWindowDimensions, JSV_xyValues |
Centers the designated browser window on the screen.
JSV_centerWindow(expX, expY | expXY)
Returns an x,y object (see JSV_xyValues) containing the distance from the left of the screen (x value) and distance from the top of the screen (y value) to place the window.
The JSV_centerWindow function uses the following arguments.
Argument | Description |
expXY | The x,y object (see JSV_xyValues) that contains the width and height, respectively, of the window to be centered. |
expX, expY | The width (expX) and height (expY) of the window to be centered. |
This function is for use with browsers that support JavaScript 1.2 or later.
For more information on centering a browser window on the screen, see JavaScript Vision Frequently Asked Questions.
n/a
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';
var myXY = new JSV_xyValues(580,240);
var jsvWindowDeltas = new JSV_xyValues();
function windowTest() {
myWindowHandle = JSV_popWindow( myWindowHandle,
myWindow,
'JSV_TestWindow.html',
myAttributes,
false);
jsvWindowDeltas = JSV_getWindowDeltas(myXY, myWindowHandle);
var centerTopLeft = JSV_windowCenter(myXY);
myWindowHandle.moveTo(centerTopLeft.x, centerTopLeft.y);
}
function windowTest2() {
var windDimensions = JSV_getWindowDimensions(myWindowHandle, jsvWindowDeltas);
var centerTopLeft = JSV_windowCenter(windDimensions);
myWindowHandle.moveTo(centerTopLeft.x, centerTopLeft.y);
myWindowHandle.focus();
}
produce
Window Center Test:
Copyright © 2000 Roaring Fork Software. All rights reserved.