点评:本文主要介绍了JS弹出层的绝对定位居中是如何实现的,有需要的朋友可以参考一下,希望对大家有所帮助!
代码如下:
function doThis()
{
var a = document.getElementById("addYear");
a.style.left=(document.body.clientWidth/2-a.clientWidth/2)+"px";
a.style.top=(document.body.scrollTop+document.body.clientHeight/2-a.clientHeight/2)+"px";
}