Home  >  Article  >  Web Front-end  >  js center advertising code on the left and right sides of the page_layout and layers

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

WBOY
WBOYOriginal
2016-05-16 17:54:451218browse

[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>
Statement:
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