Cambia Research - Supporting the Microsoft .NET Developer Community Supporting the Microsoft .NET Developer Community  

     | Home  | Articles  | Categories  | Coders  | Search  | Submit  | Contact Us    
Classes struggle, some classes triumph, others are eliminated. --Mao Zedong

Share Your Knowledge! -- Create and submit your articles the easy way with WebWriter.

Updated:02:16 AM CT Jan 11, 2007
Posted:02:13 AM CT Jan 11, 2007

Javascript Char Codes (Key Codes)

Interactive Demonstration and Lookup Table

Author: Steve Lautenschlager

ReferenceText and StringsJavascriptBrowsers

 Summary

Javascript is often used on the browser client side to perform simple tasks that would otherwise require a full postback to the server. Many of those simple tasks involve processing text or characters entered into a form element on a web page, and it is often necessary to know the javascript keycode associated with a character. Here is a reference.
Press a key in the text box below to see the corresponding Javascript key code. Or scroll down to see the full list.

   
Key Pressed Javascript Key Code
backspace 8
tab 9
enter 13
shift 16
ctrl 17
alt 18
pause/break 19
caps lock 20
escape 27
page up 33
page down 34
end 35
home 36
left arrow 37
up arrow 38
right arrow 39
down arrow 40
insert 45
delete 46
0 48
1 49
2 50
3 51
4 52
5 53
6 54
7 55
8 56
9 57
a 65
b 66
c 67
d 68
e 69
f 70
g 71
h 72
i 73
j 74
k 75
l 76
m 77
n 78
o 79
p 80
q 81
r 82
s 83
t 84
u 85
v 86
w 87
x 88
y 89
z 90
left window key 91
right window key 92
select key 93
numpad 0 96
numpad 1 97
numpad 2 98
numpad 3 99
numpad 4 100
numpad 5 101
numpad 6 102
numpad 7 103
numpad 8 104
numpad 9 105
multiply 106
add 107
subtract 109
decimal point 110
divide 111
f1 112
f2 113
f3 114
f4 115
f5 116
f6 117
f7 118
f8 119
f9 120
f10 121
f11 122
f12 123
num lock 144
scroll lock 145
semi-colon 186
equal sign 187
comma 188
dash 189
period 190
forward slash 191
grave accent 192
open bracket 219
back slash 220
close braket 221
single quote 222

Add New Comment
Print Screen Key
joy01 Mar 07, 23:01Reply 
re: Print Screen Key
Steve Lautenschlager01 Mar 07, 23:01Reply 
re: Print Screen Key
johnson24 Jan 08, 22:13Reply 
Space bar
Pat Markland13 Mar 07, 10:18Reply 
re: Space bar
Steve Lautenschlager13 Mar 07, 21:33Reply 
Javascript Char Codes (Key Codes)
Bill10 May 07, 21:17Reply 
re: Javascript Char Codes (Key Codes)
Adam17 May 07, 14:28Reply 
Thanks
Amit16 May 07, 9:58Reply 
re: Full Char Code Table
Rafael Fotnoura01 Jun 07, 9:17Reply 
re: Full Char Code Table (fixed)
Seryoga24 Jul 08, 5:37Reply 
re: Full Char Code Table (ARGH!!! It eats table tags!)
Seryoga24 Jul 08, 5:39Reply 
re: Full Char Code Table
Seryoga24 Jul 08, 5:42Reply 
Javascript Char Codes (Key Codes)
Atmaram11 Jun 07, 7:33Reply 
Semi-colon is 186 and *59*
Derek Detweiler02 Aug 07, 15:10Reply 
re: Semi-colon is 186 and *59*
Steve Lautenschlager02 Aug 07, 21:38Reply 
Javascript Char Codes (Key Codes)
cante07 Nov 07, 22:31Reply 
re: Javascript Char Codes (Key Codes)
lotuzwine22 Nov 07, 7:42Reply 
re: Javascript Char Codes (Key Codes)
Quaza09 Jan 08, 11:15Reply 
re: Javascript Char Codes (Key Codes)
Jason Miller14 Mar 08, 15:52Reply 
Scroll Wheel?
Will15 Apr 08, 5:52Reply 
CR Comments by Cambia Research
advertisement
 
Steve Lautenschlager (steve)
Steve is the founder and creator of Cambia Research. Developing and maintaining the site combines his passions for technology, writing and education.
Steve holds a Ph.D. in particle physics from Duke University, has worked at CERN, the European center for particle physics (where the web was born) and in Microsoft's web division with microsoft.com, msnbc.com and other web properties. Steve is a web consultant specializing in Microsoft.NET technologies. Read more here.


 
Copyright © Cambia Research 2002-2007. All Rights Reserved. steve [ at ] cambiaresearch.com