Home > Web Front-end > JS Tutorial > Simple absolute positioning and centering sample code for JS pop-up layer_javascript skills

Simple absolute positioning and centering sample code for JS pop-up layer_javascript skills

WBOY
Release: 2016-05-16 16:59:30
Original
1821 people have browsed it
复制代码 代码如下:

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";
}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template