Solution for document. Body. scrolltop 0

Source: Internet
Author: User
Solution for document. Body. scrolltop 0

The document. Body. scrolltop value is always 0, so you can find a solution everywhere. It turns out to be a DTD problem. If the page starts with <HTML>, there will be no problem. However, to comply with the web standards, DTD should not be less. Use document.doc umentelement. scrolltop to replace document. Body. scrolltop in dtd.

However, the document.doc umentelement. scrolltop is valid in IE, but is invalid in Firefox.

Summary:

After the DTD is removed, the document. Body. scrolltop value in IE and Firefox is normal.

After adding dtdand replacing document.doc umentelement. scrolltop with document. Body. scrolltop, ieshows normal. The value of document.doc umentelement. scrolltop (that is, document. Body. scrolltop) under firefoxis still 0.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.