asked on
function showPopup()
{
if (document.getElementById && !document.all) // Detect FF
{
var IpopTop = (window.innerHeight - document.getElementById("window").offsetHeight)/2;
var IpopLeft = (window.innerWidth - document.getElementById("window").offsetWidth)/2;
document.getElementById("window").style.left = IpopLeft + window.pageXOffset;
document.getElementById("window").style.top = IpopTop + window.pageYOffset;
}
else // Just assume otherwise (IE) at this stage.
{
var IpopTop = (document.body.clientHeight - document.getElementById("window").offsetHeight)/2;
var IpopLeft = (document.body.clientWidth - document.getElementById("window").offsetWidth)/2;
document.getElementById("window").style.left = IpopLeft + document.body.scrollLeft;
document.getElementById("window").style.top = IpopTop + document.body.scrollTop;
}
document.getElementById("window").style.visibility = "visible";
document.getElementById("greypage").style.visibility = "visible";
}
<div id="window" style="position: absolute;z-index:4;padding:5px;visibility:hidden;display: block;margin:0 auto;width:500px;border:1px solid #000000;background-color: #FFFFFF;">Populated by AJAX</div>