To obtain the ordinate position of the scroll bar of the current page, use:
Document.doc umentelement. scrolltop;
Replace: Document. Body. scrolltop;
Documentelement corresponds to an HTML Tag, while the body corresponds to a body tag. Sometimes the value of the body is always 0. In this case, you only need to change it to documentelement. The document.doc umentelement attribute is provided only after ie5.0.
Documentelement is a new attribute and is not commonly used in the past. This is easy to make mistakes during development. Many examples on the Internet are old and document. Body. scrolltop is used. In fact, the correct value is not obtained, and the obtained value is always 0.
I have encountered this problem before. I don't know if it is an IE bug. When I use the Treeview control and put the Treeview in the frame, the problem may occur. In some cases, I may only use the document. body. scrollleft cannot obtain the actual value of the position of the scrollbar. the return value is always 0. Sometimes this kind of softness is intended for compatibility, because the document.doc umentelement attribute is provided after ie5.0.