Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cancel scrolling from arrows

Status
Not open for further replies.

Izzac

Programmer
Jan 26, 2001
20
CA
Is it possible to cancel the scrolling when the up/down arrows is pressed ? By default, IE scroll the page.

I tried :
<body onscroll=&quot;return false;&quot; >


and

functionX()
{
...
window.event.cancelBubble = true;
}
document.onkeydown = functionX;


and even : (but the functionX is executed before the scroll)

functionX()
{
...
window.scrollTo(initialY)
}
document.onkeydown = funtionX;


other ideas ?

thanks!

 
I have the answer :

functionX()
{
if(window.event.keyCode == 38 || window.event.keyCode == 40)
return false;
}

document.onkeydown = functionX;

zac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top