WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 How to prevent div's content scrolling when keys up and down pressed?, Vadim, August 28, 2003
     Re:How to prevent div's content scrolling when keys up and down pressed?, Brian R. James, August 28, 2003
         Re:How to prevent div's content scrolling when keys up and down pressed?, Erik Arvidsson, August 28, 2003

Subject: Re:How to prevent div's content scrolling when keys up and down pressed? From: Brian R. James Date: August 28, 2003

Something like this should help you Vadim.  You just need to supress the onkeydown event for the up and down arrows.  I have tested this in MSIE 6.

function myDiv_onkeydown()
{
     switch (event.keyCode)
     {
          case 38: //Up Arrow
               CustomUpSelectMethod(); // <-- insert your custom select method here
               event.returnValue = false; // override default browser behavior to scroll the div
               break;
          case 40: //Down Arrow
               CustomDownSelectMethod(); // <-- insert your custom select method here
               event.returnValue = false; // override default browser behavior to scroll the div
               break;
     }
}

Brian R. James

From: Vadim
Sent: August 28, 2003
Subject: Re:How to prevent div's content scrolling when keys up and down pressed?

I have a div with vertical scrollbar contained big content (long table).

I want to select rows when pressing keys "up" & "down" instead of scrolling whole content of the div by default.

I wrote keyhandler to hook the keys but with selecting required rows whole content of the div is scrolling also.

the code :

{

.... handling the key

event.keyCode = 0;

event.cancelBubble = true;

return false;

}

doesn't take effect. Help me pls!





Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX