Home > Web Front-end > JS Tutorial > 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
Release: 2016-05-16 16:48:19
Original
1576 people have browsed it
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>
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