...

View Full Version : centre and drop a popup



tpeck
09-22-2005, 09:15 AM
Warnings aside about the desirability of the following, there are two things I would like to be able to do with a popup window:

1. resize to my preferred dimensions
2. center the window, and at a predetermined distance from the top.

How can this be done?

So far I have:

*****************

function SetSize(){
window.resizeTo(800,600);
}

<body onLoad='SetSize();">

*****************

...which only satisfies the first preference. Any ideas on the centering and distance from the top?

Thanks,

Terry

TNO
09-22-2005, 11:55 AM
Try this:

top.window.resizeTo(800,600);
top.window.moveTo((screen.availWidth/2)-400,(screen.availHeight/2)-300);

400 & 300 being half the size of your window

tpeck
09-22-2005, 11:59 AM
Thanks, I might use that - but what if it isn't the size of my normal browser window (1024 x 768)?

tpeck
09-23-2005, 05:59 AM
Nope - I'm wrong - it actually works at all pixel resolution displays.

Thanks a lot.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum