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";
}

« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3