Welcome to WebmasterWorld Guest from 54.198.106.21

Forum Moderators: open

Message Too Old, No Replies

centering pop up windows

     
10:13 pm on Mar 12, 2003 (gmt 0)

New User

10+ Year Member

joined:Mar 5, 2003
posts:38
votes: 0


What can I add to this script to make the pop up window in IE and Netscape centered.

<SCRIPT LANGUAGE="Javascript">
var browser1 = navigator.appName;
if (browser1 == "Microsoft Internet Explorer"){
var newWin = window.open("features.htm", "method_desc", "status=no,width=755,height=480");
}
else
{
var newWin = window.open("nfeatures.htm", "method_desc", "status=no,width=755,height=480");
}
</SCRIPT>

1:57 am on Mar 13, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 0


IE and Netscape use different variables in the window.open() method's feature string to position a new window. So you'll need to declare 4 variables: top= and left= for IE; screenX= and screenY= for Netscape. Now on to the calculations.

You can use screen.width to calculate left= and screenY= values with (screen.width-755)/2. A parallel approach would generate the vertical coordinates.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members