Center Popup Windows
Center popup windows in the middle of your browser.
AI
KI-Zusammenfassung: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Quellcode
<SCRIPT>
function getbrowserwidth()
{
if (navigator.userAgent.indexOf("MSIE") > 0)
{
return(document.body.clientWidth);
}
else
{
return window.outerWidth;
}
}
function getbrowserheight()
{
if (navigator.userAgent.indexOf("MSIE") > 0)
{
return(document.body.clientHeight);
}
else
{
return(window.outerHeight);
}
}
var popup = new Object()
function CenterPopup(URL, width, height)
{
// get center of browser window
var X = getbrowserwidth() / 2
var Y = getbrowserheight() / 2
popup = window.open(URL, 'PopUp',
'scrollbars=yes ' +
'width=' + width + ' ' +
'height=' + height + ' ' +
'top=' + (window.screenTop + (Y - (height/2))) + ' ' +
'left=' + (window.screenLeft + (X - (width/2)))
)
popup.focus()
}
</SCRIPT>
<A href="" onclick="CenterPopup('http://www.lewismoten.com/', 640, 480);return(false);">PopUp</A>
Originalkommentare (3)
Wiederhergestellt von der Wayback Machine