[thelist] js popup images

.jeff jeff at members.evolt.org
Mon Apr 22 14:13:00 CDT 2002


adam,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Adam
>
>    var screenTop = (screen.height / 2) - (hght / 2);
>    var screenLeft = (screen.width / 2) - (wdth / 2);
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

to avoid errors in browsers that don't support the notion of a "screen"
object, you'd do well to wrap these references in a check.

if(window.screen)
{
  var screenTop = .....
  ......
}

also, i'd be *very* careful about the use of screenTop and screenLeft as
variable names.  these are actually properties of the window object in ie5+.
maybe change them to newWindowTop and newWindowLeft.  doing this you get the
added benefit of being able to come back later and knowing that these
variables will be used for the window being assigned to the newWindow
variable.

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>    newWindow.focus();
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

the focus() method on window objects was introduced with js1.1, not js1.0.
so, it'd be wise to check for support for the focus() method before
executing it.

if(newWindow.focus)
  newWindow.focus();

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/





More information about the thelist mailing list