Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: how to set position for new window when using window.open


Message #1 by tzhang@h... on Fri, 16 Feb 2001 19:55:20
screenX and screenY are Netscape only parameters, IE uses left and top. To 
get cross-browser functionality, build the window options like this:
//first include options which are the same for both browsers
//if the option is included in the list, it should be present
//in the window being opened. If it isn't try adding "=yes" after it.
var windowOptions = 
"directories,height,location,menubar,resizable,scrollbars,status,toolbar,wi
dth";
//you should have set the variables isNav and isIE with a 
//browser detection function above here
if(isNav){
    //include Navigator-specific options
    //all the following options take values in pixels
    windowOptions += 
"innerHeight,innerWidth,outerHeight,outerWidth,screenX,screenY";
}else if(isIE){
    //include IE-specific options here
    //left and top are the IE versions of screenX and screenY
    windowOptions += "fullscreen,left,top";
}else{
    //do something else?
}
//now use your options when you open the window
window.open('url','windowName',windowOptions);

> hi,
> Try these.
> 
> screenX(in pixel) Sets the distance in pixels of the
> window from the left side of the screen.
> 
> screenY - same as above from top of the screen.
> 
> bye,
> 
> ranju.
> 
> 
> 
> --- tzhang@h... wrote: > Hi:
> > 
> > Could anybody please tell me how to set the position
> > for a new window when 
> > using window.open() in IE5.
> > 
> > Thanks!

  Return to Index