Willem Broekema <willem@pastelhorn.com> wrote:

> Or can it be explained by that doctype-switching
> box-model thingie?

Yep. Or at least a related Standards Mode fixup.

The element that represents the viewport (window) in HTML is <html>.
<body> represents only the content displayed within its work area. By
default, the body does not scroll - the root element <html> does. In
older IEs and in quirks mode, <body> represented the viewport in many
ways, including scrolling, because body was considered to effective root
element in older browsers. There is still an unpleasant kink in CSS
where body-background is moved to html-background to compensate for

So, to read the scrollTop of the viewport you would need something like
document.documentElement.scrollTop. Of course this will always be 0 in
IE5, so you would have to add the two scroll values together! Or move
IE6's scrolling element back to <body> using CSS 'overflow'. Or

IE's coloured-scrollbar style is another thing that has to be moved to
<html> instead of <body>.