views:

222

answers:

3

Hi, acyally i am wiorking on key mapping but the problem is that when i press tab/down button it navigate to the next input field tab has key of 9 and down has key of 40 but to goto the previous input field (shift+tab)what is the javascript key code for that.

what i want is if we press down it will go to next link but for previous link what is keycode or code. please help. Thanks.

+2  A: 

There's no "keycode", it's a separate property on the event object, like this:

if(event.shiftKey && event.keyCode == 9) { 
  //shift was down when tab was pressed
}
Nick Craver
what i want is if i click on up key it should go to previously selected tab so please provide some suggestion..tahnks
rajesh
@rajesh - Can you clarify a bit? Your question asks for they keycode for shift+tab, but you want to detect the up key?
Nick Craver
ya what i want if i click p button it must move to upper field which has a function like shift+tab. Hence the same i want
rajesh
@rajesh - Are you using any JavaScript libraries or no? If you're not, this is probably what you're after: http://stackoverflow.com/questions/702585/simulating-a-tab-keypress-using-javascript
Nick Craver
A: 

you can use the event.shiftKey property for that: http://www.java2s.com/Code/JavaScript/Event/Shiftkeypressed.htm

knittl