Doctype strict and IE6 - monitoring scrolling

Discussion in 'Javascript' started by Tony T, Mar 2, 2004.

  1. Tony T

    Tony T Guest

    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.btopenworld.com/scrolltest_nodoc.html and
    http://rnetworks2002.users.btopenworld.com/scrolltest_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
     
    Tony T, Mar 2, 2004
    #1
    1. Advertising

  2. 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 Honnen, Mar 2, 2004
    #2
    1. Advertising

  3. Tony T

    Tony T Guest

    "Martin Honnen" <> wrote in message
    news:4044a671$...
    >
    >
    > 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
     
    Tony T, Mar 2, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shadow Lynx
    Replies:
    1
    Views:
    565
    Shadow Lynx
    Mar 11, 2006
  2. TheKeith
    Replies:
    9
    Views:
    1,184
    Leif K-Brooks
    Oct 22, 2003
  3. John
    Replies:
    1
    Views:
    620
  4. Jeff
    Replies:
    9
    Views:
    587
    A-OK-SITE
    Jan 27, 2008
  5. Larry Lindstrom
    Replies:
    19
    Views:
    1,353
    Jonathan N. Little
    Jun 12, 2012
Loading...

Share This Page