faqts : Computers : Programming : Languages : JavaScript : Event handling

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

23 of 53 people (43%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

How to make scrollbars that handle javascript? i.e. when I scroll, scripts run and update web page

Jan 4th, 2003 06:18
Klaus Bolwin, Andrew,


In Mozilla you can use the onscroll event handler:
function LayerPos(Ereignis)
{
ypos = pageYOffset;
test(-ypos/2)
}
function test(y) 
{
document.body.style.backgroundPosition=y+'px';
document.body.style.color = "rgb(0,"+(-y/2)+","+(-y)+")";
}
document.onscroll = LayerPos;
In MSIE the event handler is:
window.onscroll = LayerPos;
window.onscroll is also working in Mozilla, but document.onscroll isn't
in MSIE.