View Full Version : Centered window

11-21-2004, 02:24 AM
Can anyone help with a little problem?

I know how to position a window by pixel co-ordinates, but how can I position a window (say centered) no matter what the screen resolution is :confused:

Hope this is in the right forum :o

11-21-2004, 01:26 PM
Have just worked it out :p

Quite simple really. If anyones interested:


var w=(screen.width-400)/2;
var h=(screen.height-300)/2;

window.open("something.html", "", width=400, height=300, left="+w+", top="+h+"")