Popup Window that is centered on screen
Login or Register to Bookmark this snippet
Create a popup window that is centered on the screen. Just supply the url, window name, width and height of the window.
function jcPopup(url,window_name,wwidth,wheight) {
//popup window that is centered on the screen.
if (!url || !window_name) {
alert ('Invalid parameters for jcPopup()');
return false;
}
if (!wwidth) {
var wwdith = 500;
}
if (!wheight) {
var wheight = 500;
}
if ((screen.availWidth-100) < wwidth) {
wwidth = (screen.availWidth-100);
}
if ((screen.availHeight-100) < wheight) {
wheight = (screen.availHeight-100);
}
window.open(url,window_name,'toolbar=no,width=' + wwidth + ',height=' + wheight + ',left=' + (screen.availWidth/2-(wwidth/2)) + ',top=' + (screen.availHeight/2-(wheight/2)) + ',scrollbars=yes');
return null;
}
Added by JC on 12th November, 2007
There are no comments about this snippet.
You must be registered and logged in to post a comment.
Login here to post a comment