[thelist] centering a popup window.....

Candace Maynard Candace.Maynard at popart.com
Wed Jan 31 18:31:48 CST 2001

I think IE doesn't use screen.width.  They use something else.. check
O'Reilly's javascript book
for how to refer to screen height and width in IE.

If that's not it, I'm sure that the way IE and NN define their
properties is different.  screenX and screenY don't
strike me as cross-browser properties.

Hope this helps.


-----Original Message-----
From: Anthony Baratta [mailto:Anthony at Baratta.com]
Sent: Wednesday, January 31, 2001 2:56 PM
To: Evolt Mailing List
Subject: [thelist] centering a popup window.....


We are developing a site that has a user login component and have
that the login screen will be a pop box. The following Javascript works 
great in Netscape, but does not work correctly in IE.

<SCRIPT language=JavaScript>
function Login() {
     var x = 0;
     var y = 0;
     var width = 110;
     var height = 170;
     theURL = "http://www.foo.com/login_popup.asp";
     winName = "fb_signin";
     x = (screen.availWidth - 12 - width) / 2;
     y = (screen.availHeight - 48 - height) / 2;
     winFeatures = "status=0,scrollbars=0,resizable=0,screenX=" + x + 
",screenY=" + y + ",width=" + width + ",height=" + height;
// -->

[NOTE: The fudging of the x and y coordinates helps to center the popup
based upon the size of the popup box. I "learned" this code from

When we click on the following link,

<a href="javascript:Login();">blah</a>

Netscape "centers" the popup box as designed. IE does not. Both report
the X and Y coordinates are the same.

Any clues or wacks up side the head are appreciated.
Anthony Baratta
Keyboard Jockeys

For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt ! 

More information about the thelist mailing list