JavaScript get page width and height

Width of
visible area of ​​web page: document.body.clientWidth Height
of visible area of
​​web page: document.body.clientHeight Width)
Web page body full text width: document.body.scrollWidth
Web page text full text height: document.body.scrollHeight
Web page is scrolled height: document.body.scrollTop (IE7 invalid)
Web page is scrolled to the left: document.body.scrollLeft (IE7 doesn't work)

The height of the web page being scrolled: document.documentElement.scrollTop (IE7 valid)

The left page of the page being scrolled: document.documentElement.scrollLeft (effective for IE7) on the body part of the page
: window.screenTop The
page body part left: window.screenLeft
The height of the
screen resolution: window.screen.height The width of the screen resolution: window .screen.width
screen available workspace height: window.screen.availHeight
screen available workspace width: window.screen.availWidth

X relative to the upper left corner of the window: window.event.clientX

Y relative to the upper left corner of the window: window.event.clientY
X
relative to the entire page: window.event.X Y relative to the entire page: window.event.Y

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325070911&siteId=291194637