Learn Create Your Own Split Screen

Next Page

keyCodes are a bit weird but very powerful.

They really are key codes and not character codes. For example, you can even detect the Shift key going down. And you can tell the difference between the numbers running across the top of the keyboard and the numeric keypad.

Here's a selection of some codes.

Key keyCode
Left arrow 37
Right arrow 39
Up arrow 38
Down arrow 40
Space bar 32
Escape 27
A - Z 65-90
0 - 9 48-57
Shift 16
Control 17
Alt 18
Enter 32
CapsLock 20
Backspace 8
Tab 9