Home > Web Front-end > JS Tutorial > body text

How to get body.clientHeight after doctype_javascript skills

WBOY
Release: 2016-05-16 19:11:14
Original
1275 people have browsed it

In ie6, problems will occur when executing many js scripts. Generally, incorrect values ​​will be returned when obtaining clientWidth, clientHeight, offsetWidth, offsetHeight, scrollWidth, scrollHeight, scrollTop, and scrollLeft.

Because after adding doctype, these document.body attributes have been reassigned to document.documentElement in ie6.

For example: the original document.body.clientHeight should be changed to document.documentElement.scrollTop

In order to adapt, you can change the following code:



((document.documentElement.clientHeight==0)?document.body.clientHeight:document.documentElement.clientHeight)


Using such code can be adaptive.

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