Home  >  Article  >  Web Front-end  >  js gets page height and width compatible with ie firefox chrome, etc._javascript skills

js gets page height and width compatible with ie firefox chrome, etc._javascript skills

WBOY
WBOYOriginal
2016-05-16 16:48:191546browse
Copy code The code is as follows:

<script> <br>//Get the page height<br> var yScroll = (document.documentElement.scrollHeight >document.documentElement.clientHeight) ? document.documentElement.scrollHeight : document.documentElement.clientHeight; <br>alert(yScroll) <br>//Get the page width<br>var xScroll =(document.documentElement.scrollWidth>document.documentElement.clientWidth) ? document.documentElement.scrollWidth : document.documentElement.scrollWidth; <br>alert(xScroll) <br></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