Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am try to do the Key mapping using JS.
currently tab is used to move one tab to other in web page.
same thing I want to do using arrow (up,down,left,right) key.
If I press up arrow key control will move to upper Htmlcontrol(like textbox radiobutton etc).
If I press down arrow key Control will move to down Htmlcontrol.
same as left and right...



Please
Help me!..
Posted
Updated 28-Jun-10 17:58pm
v2
Comments
Prosanta Kundu online 30-Jun-10 23:45pm    
You can do the same by simply adding keyress handler on your document. Please provide some more information regarding layout of your page, i.e. how the controls are placed inside the document.

1 solution

Sir, I think you need to handle onkeydown events for these controls. you can obtain keycode by the code:

JavaScript
var evt = (window.event) ? event : null;
if (evt) {
    var charCode = (evt.charCode) ?
      evt.charCode :
      ((evt.keyCode) ? evt.keyCode :
        ((evt.which) ? evt.which : 0));

}


you can also use this page to test key codes.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900