Javascript pop up centering

They have: 32 posts

Joined: Jan 2001

I need a pop up window centered on the screen. I have code to pop up the window how do I center the window?

function NEWWIN(address)
{
NewWin = window.open(address, "NewWin", "width=800,height=550");
NewWin.focus();
return false;
}

Thank you very Much!!!!!!!

Mike

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

try this:

function NEWWIN(address)
{
NewWin = window.open(address, "NewWin", "width=" + (screen.width-800)/2 + ",height=" + (screen.height-550)/2);
NewWin.focus();
return false;
}
'

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.