In javascript - window.open opens a pop-up that by default opens at random location of the window. Below is a javascript function that will open a pop-up in the center of the client window. Hope it may save many additional lines of javascript code.
function windowOpener(windowHeight, windowWidth, windowName, windowUri)
{
var centerWidth = (window.screen.width - windowWidth) / 2;
var centerHeight = (window.screen.height - windowHeight) / 2;
newWindow = window.open(windowUri, windowName, 'resizable=0,width=' + windowWidth +
',height=' + windowHeight +
',left=' + centerWidth +
',top=' + centerHeight);
newWindow.focus();
return newWindow.name;
}
Please notice parameters that are passed to window.open.
Sunday, May 13, 2007
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment