PDA

View Full Version : temporarily prevent up/down arrow keys from page scrolling


brothercake
01-06-2003, 11:34 AM
What I need to do is be able to disable page-scrolling with the arrow keys, temporarily, so that I can use those arrows as navigation keys within a dhtml menu.

Does anyone have any ideas about this might be possible? Any ludicrous suggestions are welcome - it is absolutely vital I find a way.

joeframbach
01-06-2003, 12:06 PM
its possible...

function handleKeyPress()
{
var key=event.keyCode
switch(key)
{
case 38:
//do something for up arrow
break;
case 40:
//do something for down arrow
break;
}
}


<BODY onKeyDown="handleKeyPress();return false;">

brothercake
01-06-2003, 12:44 PM
ripper :thumbsup:

so simple ... thanks