Quick how-to for capturing a page scroll event?

Hello,

Can anyone give me a quick how-to for firing off a function when the page is scrolled? I only need it for firefox. I tried to do:

function onPageScroll(){
	alert('test page scroll');
}


if (window.addEventListener)
        window.addEventListener('scroll', onPageScroll, false);
}


but that didnt work. any help is appreciated.

I have two versions of Firefox, 1.0.2 and 1.5.0.7 (on WinXP). Both the following work in v1.5. In v1.02 they both work but only when you drag the scrollbar (doesn’t work with scroll-wheel).


  window.onscroll = listener1;
  window.addEventListener('scroll', listener2, false);

thanks…i got it to work, but this error I am dealing with is actually occuring a hair before the scroll event is fired. Do you know if there is a way to capture an event for the scrollbar being released? The nearest I cant tell right now is that the order of events is mouse release > error occuring > scroll event.

That site requires flash.