Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Doctype strict and IE6 - monitoring scrolling

Reply
Thread Tools

Doctype strict and IE6 - monitoring scrolling

 
 
Tony T
Guest
Posts: n/a
 
      03-02-2004
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


 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      03-02-2004


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/

 
Reply With Quote
 
 
 
 
Tony T
Guest
Posts: n/a
 
      03-02-2004
"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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CSS Newbie - CSS Works With Invalid DOCTYPE. Fails With Valid DOCTYPE. Larry Lindstrom HTML 19 06-12-2012 02:07 PM
javascript and strict doctype Jeff HTML 9 01-27-2008 04:05 PM
Struts and XHTML strict doctype John Java 1 01-13-2008 11:51 PM
DOCTYPE Strict uses "correct" box model - so why is 100% width now useless? Shadow Lynx ASP .Net 1 03-11-2006 10:26 PM
Form target attribute--not validating with strict doctype? TheKeith HTML 9 10-21-2003 11:06 PM



Advertisments