Hi all, I am writing a routine to be triggered when the page is scrolled, but seem to be having problems with IE6. A sample page is [URL=http://www.users.bigpond.net.au/ggoodacre/basics2%20scroll%20test.html]here[/URL] . The page layout is one of Stu Nicholls, and uses divs to emulate frames, and the scrollbar is actually on one of the divs, not the document – this may be the problem. On the sample page, an alert box pops up as it should in FF but not IE. It seems like the onscroll event is not propagating to the window level in IE – maybe I need to sense the onscroll even on another element?
@JulianJJun 20.2006 — #Because it is the DIV that is scrolling, not the window. You need to attach the event to the content DIV after it has been created, like so:
I did try the getElementById construct, but only in the same place as the window.onscroll, and it didn't work - didn't think of putting in body onload, though now I can see that the div would probably have to be defined BEFORE setting an action on it...
This does raise the question of event bubbling - I would have thought that a div scroll event would bubble through to the window object, and it appears to do so in Firefox - kind of strange IE didn't accept it when they pioneered event bubbling...???
@phpnoviceJun 20.2006 — #This does raise the question of event bubbling - I would have thought that a div scroll event would bubble through to the window object, and it appears to do so in Firefox - kind of strange IE didn't accept it when they pioneered event bubbling...???[/QUOTE] Possibly this is because the window doesn't scroll when an embeded element scrolls. Conversely, if you click on an embeded element, then the document was also clicked on -- thus, this event bubbles. So, it seems that events bubble up to the document level -- but not to the window level. Don't know (just being logical). ?