By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,141 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

Doctype strict and IE6 - monitoring scrolling

P: n/a
I'm not a regular here - strictly an amateur web developer - but I've got so
frustrated I'd really appreciate any help anyone can give. I'm working on a
PC platform with Win ME.

I'm developing a new set of web pages, using html4.01 strict with css2
stylesheets. As part of the design, I need to be able to monitor and measure
the vertical scrolling of my document in the viewport. I have got this to
work with up-to-date Netscape and Opera browsers using window.pageYOffset,
but good ol' IE6 has me stumped. My actual pages validate for both html and
css, and I've got other arrangements for earlier and other browsers, so it's
just IE6 that's the problem. Please take a look at these stripped-down
examples (also valid) -

http://rnetworks2002.users.btopenwor...est_nodoc.html and
http://rnetworks2002.users.btopenwor...st_strict.html

You'll see that in the first case, with no DOCTYPE declaration,
document.body.scrollTop returns a value according to the scroll position. In
the second case, with the DOCTYPE declaration, doc.body.scrollTop no longer
varies.

I need the strict doctype for the pages to render correctly with my
stylesheet, so I can't just get rid of the doctype, nor do the pages or
doc.body.scrollTop work if I change the DOCTYPE to transitional (with or
without dtd url). Dropping the url from the strict DOCTYPE doesn't affect
the behaviour of document.body.scrollTop.

I've tried my usual resources (as well as a search here) for ideas, but
without success. So, please can anyone tell me either how to get scrollTop
to work with a strict doctype declaration, or some other way to monitor
scrolling which works in IE6 and html4.01 strict.

Thanks for any help.
--
Tony T
Replace 'from' with 'to' (twice) for e-mail
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a


Tony T wrote:

I'm developing a new set of web pages, using html4.01 strict with css2
stylesheets. As part of the design, I need to be able to monitor and measure
the vertical scrolling of my document in the viewport. I have got this to
work with up-to-date Netscape and Opera browsers using window.pageYOffset,
but good ol' IE6 has me stumped.


You are looking for
document.documentElement.scrollTop/scrollLeft
for IE6 in strict rendering mode (check
if (document.compatMode && document.compatMode != 'BackCompat') {
... document.documentElement.scrollTop...
}
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

P: n/a
"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:40********@olaf.komtel.net...


Tony T wrote:

I'm developing a new set of web pages, using html4.01 strict with css2
stylesheets. As part of the design, I need to be able to monitor and measure the vertical scrolling of my document in the viewport. I have got this to work with up-to-date Netscape and Opera browsers using window.pageYOffset, but good ol' IE6 has me stumped.


You are looking for
document.documentElement.scrollTop/scrollLeft
for IE6 in strict rendering mode (check
if (document.compatMode && document.compatMode != 'BackCompat') {
... document.documentElement.scrollTop...
}
--

Martin Honnen
http://JavaScript.FAQTs.com/


Martin - thanks. You're a star!
--
Tony T
Replace 'from' with 'to' (twice) for e-mail
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.