PDA

View Full Version : Centering the current window


antipop
08-09-2002, 12:59 PM
I'm trying to insert some code which will centre the current window on the screen. At the moment, I'm using a script which repositions a window of a set size, which works fine. However, now I need to centre a window which could be any size.

Here's the code I'm using:

var grosse_width = screen.availWidth / 2;
var grosse_height = screen.availHeight / 2;
window.moveTo(grosse_width - 395,grosse_height - 250);

Is there a way of replacing the width value 395 and the height value 250 with code representing the size of the currend window? It would need to be self / 2 or something I suppose...

Thanks in advance,
Andrew

A1ien51
08-09-2002, 02:36 PM
you can set the size of the window by doing:

window.resizeTo(100,100);

then you will know the size of the window!

antipop
08-12-2002, 01:13 PM
Thanks, I'll give it a shot