js acquired page width and height available

The visible area of ​​the page width: document.body.clientWidth

Highly visible page area: document.body.clientHeight

Page wide visible region: document.body.offsetWidth (including edge width)

High visible area page: document.body.offsetHeight (including edge width)

Full body of the page width: document.body.scrollWidth

Body of the page GAO: document.body.scrollHeight

Page volume to be high: document.body.scrollTop

Web is rolled to the left: document.body.scrollLeft

On the body of the page: window.screenTop

The body of the page left: window.screenLeft

High screen resolution: window.screen.height

Wide screen resolution: window.screen.width

Screen available work area height: window.screen.availHeight

Available Workspace screen width: window.screen.availWidth

HTML precise positioning: scrollLeft, scrollWidth, clientWidth, offsetWidth

scrollHeight: get rolling height of the object.

Gets or sets the distance between the object located in the left and the contents of the window currently visible leftmost: scrollLeft

scrollTop: Set or get the distance between the object located in the top of the topmost visible in the window contents

scrollWidth: Get Object rolling width

offsetHeight: Get the object relative to the layout coordinates of the parent or

offsetParent property specifies the height of the parent coordinates

offsetLeft: Get the object relative to the layout or

Left coordinate position calculation parent attribute specified offsetParent

offsetTop: Get the top position of the object relative to the layout or calculate specified by the attribute of the parent coordinate offsetTop

Event.clientX relatively horizontal coordinate document

The vertical coordinate relative to the document event.clientY

The horizontal coordinate relative to the container event.offsetX

The vertical coordinate relative to the container event.offsetY

document.documentElement.scrollTop vertical scroll value

event.clientX + document.documentElement.scrollTop horizontal coordinate relative to the document in the vertical direction of the scroll amount +

IE,FireFox 差异如下: 
IE6.0、FF1.06+: 
clientWidth = width + padding 
clientHeight = height + padding 
offsetWidth = width + padding + border 
offsetHeight = height + padding + border 
IE5.0/5.5: clientWidth = width - border 
clientHeight = height - border 
offsetWidth = width 
offsetHeight = height

Guess you like

Origin blog.csdn.net/zhu_nana/article/details/81299204