首页 > 语言 > JavaScript > 正文

JS弹出层单纯的绝对定位居中示例代码

2024-05-06 14:29:33
字体:
来源:转载
供稿:网友
代码如下:
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";
}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选