The visible area width of the web page: document.body.clientWidth;
The visible area height of the web page: document.body.clientHeight;
The visible area width of the web page: document.body.offsetWidth (including the width of edges and scroll bars);
The visible area height of the web page: document.body.offsetHeight (including the width of the edge);
The full text width of the web page: document.body.scrollWidth;
The full text of the web page is high: document.body.scrollHeight;
The high (ff): document.body.scrollTop;
The height of the web page being rolled off (ie): document.documentElement.scrollTop;
The left of the web page being rolled out: document.body.scrollLeft;
On the main part of the web page: window.screenTop;
Left of the main text of the web page: window.screenLeft;
The width of an element: obj.offsetWidth;
The height of an element: obj.offsetHeight;
The distance from the upper boundary of an element to the topmost part of the body: obj.offsetTop; (if the element contains elements without scroll bars)
The distance from the left boundary of an element to the leftmost left of the body: obj.offsetLeft; (if the element contains elements without scroll bars)
Returns the offset from the upper boundary of the current element to its upper boundary containing the element: obj.offsetTop (in the case where the element contains the element and contains the scroll bar)
Returns the offset from the left boundary of the current element to its left boundary containing the element: obj.offsetLeft (in the case where the element contains the element and contains the scroll bar)
scrollTop, scrollLeft
Sets or returns the number of pixels that have been scrolled to the left or upper boundary of the element. These pixels are only useful when the element has a scrollbar, for example, when the element's CSS overflow property is set to auto. These properties are also defined only on the <body> or <html> tags of the document (this is related to the browser), and together they define the location of the scrolling document. Note that these properties do not specify the scrolling amount of a <iframe> tag. This is a non-standard but well supported property
The above code for obtaining pages and elements height and width of js is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.