Geekpedia Tutorials Home

Building a C# Chat Client and Server

Building a C# Chat Client and ServerA step by step tutorial teaching you how to create your own chat client and chat server easily in C#, for local networks or the Internet.

in C# Programming Tutorials

Getting Hard Drive Information

Getting Hard Drive InformationA C# tutorial showing you how to make use of WMI to extract information on disk drives, such as model, capacity, sectors and serial number.

in C# Programming Tutorials

UPS Shipping Calculator

UPS Shipping CalculatorThis tutorial will teach you how to calculate the shipping cost based on the weight, height, length and depth of the box, the distance and the UPS service type.

in PHP Programming Tutorials

Create Your Own Rich Text Editor

Create Your Own Rich Text EditorCreating a Rich Text Editor using JavaScript is easier to do than you might think, thanks to the support of modern browsers; this tutorial will walk you through it.

in JavaScript Programming Tutorials
Search
Tutorials
Programming Tutorials
IT Jobs
From CareerBuilder

A list of keys and the JavaScript char codes they correspond to

On Saturday, August 13th 2005 at 01:09 PM
By Andrew Pociu (View Profile)
*****   (Rated 5 with 2 votes)
Advertisement
More JavaScript Resources
This table is especially useful for those who want to capture the key press event in the browser window. These are the char codes JavaScript uses, and the keys they bind to:

Char
Key Name
8 Backspace
9 Tab
13 Enter
16 Shift
17 Ctrl
18 Alt
19 Pause
20 Caps Lock
27 Escape
33 Page Up
34 Page Down
35 End
36 Home
37 Arrow Left
38 Arrow Up
39 Arrow Right
40 Arrow Down
45 Insert
46 Delete
48 0
49 1
50 2
51 3
52 4
53 5
54 6
55 7
56 8
57 9
65 A
66 B
67 C
68 D
69 E
70 F
71 G
72 H
73 I
74 J
75 K
76 L
77 M
78 N
79 O
80 P
81 Q
82 R
83 S
84 T
85 U
86 V
87 W
88 X
89 Y
90 Z
91 Left Windows
92 Right Windows
93 Context Menu
96 NumPad 0
97 NumPad 1
98 NumPad 2
99 NumPad 3
100 NumPad 4
101 NumPad 5
102 NumPad 6
103 NumPad 7
104 NumPad 8
105 NumPad 9
106 NumPad *
107 NumPad +
109 NumPad -
110 NumPad .
111 NumPad /
112 F1
113 F2
114 F3
115 F4
116 F5
117 F6
118 F7
119 F8
120 F9
121 F10
122 F11
123 F12
144 Num Lock
145 Scroll Lock
186 ;
187 =
188 ,
189 -
190 .
191 /
192 `
219 [
220 \
221 ]
222 '
Digg Digg It!     Del.icio.us Del.icio.us     Reddit Reddit     StumbleUpon StumbleIt     Newsvine Newsvine     Furl Furl     BlinkList BlinkList

Rate Rate this Knowledge Base article
Comment Current Comments
by jim nesbitt on Thursday, March 30th 2006 at 03:31 AM

At last - This must be about the only place on the web this exists

Many thanks Andrei

Jim

by Dimitris on Tuesday, May 23rd 2006 at 03:12 PM

And What about Ctrl+Q , Ctrl+Z, Ctrl+S key codes?

Thanks, another Jim (Dimitris)

by John Cruz on Friday, January 26th 2007 at 03:26 PM

Looked over for this.. Thank you very much!!
John

by on Wednesday, February 21st 2007 at 09:43 AM

3

by mike breuner on Thursday, June 7th 2007 at 09:49 PM

Excellent. Useful.

Any possibility of posting where this comes from. Is there a Standard or Manual somewhere?

by Neil Poole on Friday, June 8th 2007 at 04:32 AM

Very useful. You could add SpaceBar=32

by thanhnx on Friday, February 29th 2008 at 11:11 AM

Wonderful ! Really useful.

by Stiba on Sunday, January 4th 2009 at 01:43 AM

function getCharDesc(char_code)
{
switch(char_code)
{
case 8:return "backspace";
case 9:return "tab";
case 13:return "enter";
case 16:return "shift";
case 17:return "ctrl";
case 18:return "alt";
case 19:return "pause/break";
case 20:return "caps lock";
case 27:return "escape";
case 33:return "page up";
case 34:return "page down";
case 35:return "end";
case 36:return "home";
case 37:return "left arrow";
case 38:return "up arrow";
case 39:return "right arrow";
case 40:return "down arrow";
case 45:return "insert";
case 46:return "delete";
case 48:return "0";
case 49:return "1";
case 50:return "2";
case 51:return "3";
case 52:return "4";
case 53:return "5";
case 54:return "6";
case 55:return "7";
case 56:return "8";
case 57:return "9";
case 65:return "A";
case 66:return "B";
case 67:return "C";
case 68:return "D";
case 69:return "E";
case 70:return "F";
case 71:return "G";
case 72:return "H";
case 73:return "I";
case 74:return "J";
case 75:return "K";
case 76:return "L";
case 77:return "M";
case 78:return "N";
case 79:return "O";
case 80:return "P";
case 81:return "Q";
case 82:return "R";
case 83:return "S";
case 84:return "T";
case 85:return "U";
case 86:return "V";
case 87:return "W";
case 88:return "X";
case 89:return "Y";
case 90:return "Z";
case 91:return "left window key";
case 92:return "right window key";
case 93:return "select key";
case 96:return "numpad 0";
case 97:return "numpad 1";
case 98:return "numpad 2";
case 99:return "numpad 3";
case 100:return "numpad 4";
case 101:return "numpad 5";
case 102:return "numpad 6";
case 103:return "numpad 7";
case 104:return "numpad 8";
case 105:return "numpad 9";
case 106:return "multiply";
case 107:return "add";
case 109:return "subtract";
case 110:return "decimal point";
case 111:return "divide";
case 112:return "F1";
case 113:return "F2";
case 114:return "F3";
case 115:return "F4";
case 116:return "F5";
case 117:return "F6";
case 118:return "F7";
case 119:return "F8";
case 120:return "F9";
case 121:return "F10";
case 122:return "F11";
case 123:return "F12";
case 144:return "num lock";
case 145:return "scroll lock";
case 186:return "semi-colon";
case 187:return "equal sign";
case 188:return "comma";
case 189:return "dash";
case 190:return "period";
case 191:return "forward slash";
case 192:return "grave accent";
case 219:return "open bracket";
case 220:return "back slash";
case 221:return "close braket";
case 222:return "single quote";
}
}

by Jean Dreesen on Saturday, May 23rd 2009 at 03:58 PM

Did I overlook print screen? Where is it?

by JohnM on Thursday, September 10th 2009 at 09:36 PM

I think you missed the lowercase letters. :)

by Corrine on Friday, September 18th 2009 at 12:00 PM

I might be missing something, but this does not work in IE8

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Fri, 18 Sep 2009 15:58:59 UTC

"'keyCode' is null or not an object"

by Corrine on Friday, September 18th 2009 at 01:29 PM

Nevermind, there was a naming issue. It's all working quite well. :)

by Savvy on Thursday, November 12th 2009 at 10:58 PM

This code for printting comma if we press dot in the numpad

<html>
<heaD>
<script language="javascript">
function keypress1 ()
{
var e=window.event || e
unicode = e.charCode ? e.charCode : e.keyCode;
if (unicode==46)
{ return (e.charCode ? e.charCode=44 : e.keyCode=44); }
}
function keypress2 ()
{
var e=window.event || e
unicode = e.charCode ? e.charCode : e.keyCode;
if (unicode==46)
{ return (e.charCode ? e.charCode=46 : e.keyCode=46); }
}
function keyDown(e){
if (!e){
e = event
}
var code=e.keyCode;
if(code==110)
return document.onkeypress=keypress1
else if(code=188)
{ document.onkeypress=keypress2 }
}
document.onkeydown = keyDown
</script>
</head>
<body>
<input type=text>
</body>
</html>

by Savvy on Thursday, November 12th 2009 at 10:58 PM

This code for printting comma if we press dot in the numpad

<html>
<heaD>
<script language="javascript">
function keypress1 ()
{
var e=window.event || e
unicode = e.charCode ? e.charCode : e.keyCode;
if (unicode==46)
{ return (e.charCode ? e.charCode=44 : e.keyCode=44); }
}
function keypress2 ()
{
var e=window.event || e
unicode = e.charCode ? e.charCode : e.keyCode;
if (unicode==46)
{ return (e.charCode ? e.charCode=46 : e.keyCode=46); }
}
function keyDown(e){
if (!e){
e = event
}
var code=e.keyCode;
if(code==110)
return document.onkeypress=keypress1
else if(code=188)
{ document.onkeypress=keypress2 }
}
document.onkeydown = keyDown
</script>
</head>
<body>
<input type=text>
</body>
</html>


Comment Comment on this Knowledge Base article
Name: Email:
Message:
Knowledge Base Related Knowledge Base Articles
There are no related KB articles.

Comment Related Source Code
There is no related code.

Comment Related Tutorials
There are no related tutorials.

Jobs JavaScript Job Search
My skills include:

Enter a City:

Select a State:


Advanced Search >>
Sponsors
Discover Geekpedia

Other Resources