"Michael Winter" <M.Winter@[no-spam]blueyonder.co.uk> wrote in message
news:g5*********************@news-text.cableinet.net...
"Thomas 'PointedEars' Lahn" wrote on 12/11/2003:
Cool Mentalist wrote:
is there a method to get scrollbar position?
window.pageXOffset
window.pageYOffset
Is the IE implementation of those properies broken or missing?
<snip>
IE does not implement them at all. They are the preferred values to read
but if absent (so in IE) the scrollTop and scrollLeft values can be read
from the root element. Exactly which element is the root element depends
on the browser/version _and_ (if it exists) the "compatMode".
In the absence of pageXOffset/YOffset value I would test to see if
document.compatMode is defined, if it is not then the root element is
document.body. If it is defined and holds the string value "CSS1Compat"
then the root element is document.documentElement (the HTML element) and
the scroll values should be read from there. Any other values of
document.compatMode ("BackCompat", "QuirksMode", etc) mean that
document.body is still the root element and it should be read for the
required values.
Richard.