Home > Web Front-end > JS Tutorial > body text

js center advertising code on the left and right sides of the page_layout and layers

WBOY
Release: 2016-05-16 17:54:45
Original
1221 people have browsed it

[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]<script> window.onload=window.onscroll=function() { var oLeft = document.getElementById("left"); var oRight = document.getElementById("right"); var scrollY=document.documentElement.scrollTop||document.body.scrollTop; var clientH = document.documentElement.clientHeight; var oCloseX =document.getElementById("x") var oCloseY =document.getElementById("y") oLeft.style.top=(clientH-oLeft.offsetHeight)/2+scrollY+"px"; oRight.style.top=(clientH-oRight.offsetHeight)/2+scrollY+"px"; oCloseX.onclick=function() { this.parentNode.parentNode.removeChild(this.parentNode); } } </script>
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