423,688 Members | 1,894 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,688 IT Pros & Developers. It's quick & easy.

window.onscroll and firefox

P: n/a
Looks like firefox doesn't support onscroll. Any workaround?
Sep 1 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Simon Wigzell wrote :
Looks like firefox doesn't support onscroll. Any workaround?


Not true. Firefox support scroll event as specified by DOM 2 Events
(document) and DOM 3 Events (element).

Gérard
--
remove blah to email me
Sep 1 '05 #2

P: n/a

"Gérard Talbot" <ne***********@gtalbot.org> wrote in message
news:3n************@uni-berlin.de...
Simon Wigzell wrote :
Looks like firefox doesn't support onscroll. Any workaround?


Not true. Firefox support scroll event as specified by DOM 2 Events
(document) and DOM 3 Events (element).

Gérard
--
remove blah to email me


Well - then why does the following work (you get the alert when you move the
scroll bar) for IE, Netscape and Opera but not firefox?

<html>
<body>
<script language="JavaScript1.2">
window.onscroll = doOnScroll;

function doOnScroll()
{
alert("doOnScroll");
}
</script>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
</body>
</html>
Sep 1 '05 #3

P: n/a
Simon Wigzell schrieb:
"Gérard Talbot" <ne***********@gtalbot.org> wrote in message
news:3n************@uni-berlin.de...
Simon Wigzell wrote :
Looks like firefox doesn't support onscroll. Any workaround?


Not true. Firefox support scroll event as specified by DOM 2 Events
(document) and DOM 3 Events (element).

Gérard
--
remove blah to email me

Well - then why does the following work (you get the alert when you move the
scroll bar) for IE, Netscape and Opera but not firefox?

<html>
<body>
<script language="JavaScript1.2">
window.onscroll = doOnScroll;

function doOnScroll()
{
alert("doOnScroll");
}
</script>


Maybe because FF doesn't like language="JavaScript1.2", maybe because there's no
() after the functioncall, didn't tested out, but surely the following is
working in IE6, Opera8.01, FF1.0.6:

<html>
<head>
<script type="text/javascript">
function doOnScroll()
{
alert("doOnScroll");
}
</script>
</head>
<body onscroll="doOnScroll();">
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
</body>
</html>
Sep 1 '05 #4

P: n/a
Lee
Simon Wigzell said:


"Gérard Talbot" <ne***********@gtalbot.org> wrote in message
news:3n************@uni-berlin.de...
Simon Wigzell wrote :
Looks like firefox doesn't support onscroll. Any workaround?


Not true. Firefox support scroll event as specified by DOM 2 Events
(document) and DOM 3 Events (element).

Gérard
--
remove blah to email me


Well - then why does the following work (you get the alert when you move the
scroll bar) for IE, Netscape and Opera but not firefox?

<html>
<body>
<script language="JavaScript1.2">


You're specifically telling it to only load the code in browsers
that are running Javascript version 1.2. That's not a good idea.

<script type="text/javascript">

Sep 1 '05 #5

P: n/a
Simon Wigzell wrote :
"Gérard Talbot" <ne***********@gtalbot.org> wrote in message
news:3n************@uni-berlin.de...
Simon Wigzell wrote :
Looks like firefox doesn't support onscroll. Any workaround?

Use DOM 2 Events methods:

http://www.gtalbot.org/BugzillaSecti...rollEvent.html

Bug 35011, bug 189308, bug 144868 and several others related to
scrolling have been fixed too.
https://bugzilla.mozilla.org/show_bug.cgi?id=35011
https://bugzilla.mozilla.org/show_bug.cgi?id=189308
https://bugzilla.mozilla.org/show_bug.cgi?id=144868

DOM 3 Events interactive example (scroll event for element):
http://www.mozilla.org/docs/dom/domr...p.html#Example

Gérard
--
remove blah to email me
Sep 2 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.