Tuesday, 1 April 2008

JavaScript - Popup windows

function Popup( url, height, width )
{
var windowProperties = "toolbar = 0, scrollbars = 1, location = 0, statusbar = 0, menubar = 0, resizable = 1, width = " + width + ", height = " + height + ", left = 50, top = 50";

return window.open( url, "", windowProperties );
}

function PopupScale( url, scale )
{
// Default sizes.
var height = 800;
var width = 800;

if ( window.screen )
{
height = window.screen.availHeight * scale / 100;
width = window.screen.availWidth * scale / 100;
}

Popup( url, height, width );
}

Example:

No comments: