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 |
---|---|---|
Tab | 9 | |
Enter/Return | 13 | |
Shift | 16 | Not applicable for edit areas |
Ctrl | 17 | Not applicable for edit areas |
Escape | 27 | |
Left arrow | 37 | |
Up arrow | 38 | |
Right arrow | 39 | |
Down arrow | 40 | |
0-9 | 48-57 | |
a-z | 65-90 | |
A-Z | 97-122 | Only 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:
Post a Comment