Tip: keyCode quick reference

Tuesday, March 25, 2008 at 1:33 PM



When you write code to handle keyboard events in a gadget, knowing the most commonly used JavaScript keyCodes can save you time. Here's a quick reference:

Key
keyCode
Notes
Tab9
Enter/Return 13
Shift16Not applicable for edit areas
Ctrl17Not applicable for edit areas
Escape27
Left arrow37
Up arrow38
Right arrow39
Down arrow40
0-948-57
a-z65-90
A-Z97-122Only applicable for edit areas

If you want more details, consult a complete list of keyCodes. For an example of using a keyCode in a gadget, see my previous post, Tip: Support tab navigation.

Have a tip you'd like to share? Send it to gd-developer AT google DOT com. To see all tips, choose the Tips label.

No comments: