0% found this document useful (0 votes)
55 views

Js Key Code

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

Js Key Code

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Javascript Char Codes (Key Codes) - Cambia Research http://www.cambiaresearch.com/articles/15/javas...

Increasingly, people seem to misinterpret complexity as sophistication... --Niklaus Wirth

Log In

Software Better
Home → Articles → Javascript Char Codes (Key Codes) Home Search Articles Categories About

38 Email List Like 58


Welcome to my blog
about software
development and the
Javascript Char Codes (Key Codes) Microsoft stack.
Interactive Demonstration and Lookup Table
I've been a full time .NET developer for
By steve on January 11, 2007. ten years, but I didn't start my
Updated on January 12, 2013. professional life as a programmer ...
Viewed 2,892,097 times (507 times today). more

Missouri River Rail Bridge - 12/2011. Copyright © Steve


Lautenschlager
Sign Up!
Developer Tools and Tables Javascript
38 Subscribers

Share/Print this page:


Share
Share
Share
Share 124

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.

Try it! escape KeyCode: 27

Key Code Key Code Key Code

backspace 8 e 69 numpad 8 104

tab 9 f 70 numpad 9 105

enter 13 g 71 multiply 106

shift 16 h 72 add 107

ctrl 17 i 73 subtract 109

alt 18 j 74 decimal point 110

pause/break 19 k 75 divide 111

caps lock 20 l 76 f1 112

escape 27 m 77 f2 113

page up 33 n 78 f3 114

page down 34 o 79 f4 115

1 of 4 11/12/14 17:47
Javascript Char Codes (Key Codes) - Cambia Research http://www.cambiaresearch.com/articles/15/javas...

end 35 p 80 f5 116

home 36 q 81 f6 117

left arrow 37 r 82 f7 118

up arrow 38 s 83 f8 119

right arrow 39 t 84 f9 120

down arrow 40 u 85 f10 121

insert 45 v 86 f11 122

delete 46 w 87 f12 123

0 48 x 88 num lock 144

1 49 y 89 scroll lock 145

2 50 z 90 semi-colon 186

3 51 left window key 91 equal sign 187

4 52 right window key 92 comma 188

5 53 select key 93 dash 189

6 54 numpad 0 96 period 190

7 55 numpad 1 97 forward slash 191

8 56 numpad 2 98 grave accent 192

9 57 numpad 3 99 open bracket 219

a 65 numpad 4 100 back slash 220

b 66 numpad 5 101 close braket 221

c 67 numpad 6 102 single quote 222

d 68 numpad 7 103

Back to Top

2 of 4 11/12/14 17:47
Javascript Char Codes (Key Codes) - Cambia Research http://www.cambiaresearch.com/articles/15/javas...

152 Comments Cambia Research  Login

Sort by Best Share ⤤ Favorite ★

Join the discussion…

Developer • a year ago


How could you handle the "F11" key without show the page in Full Screen mode??
When I use "on key down" in my aplication, I can capture the event, but, anyway the browser show the
full screen mode!
13 • Reply • Share ›

Fllamber > Developer • a year ago


Use the function:
event.preventDefault()
Right after you catch the "F11" event
e.g:
if(event.keyCode == 122) {
event.preventDefault()
console.log('F11 was pressed');
}
28 • Reply • Share ›

andyjv > Developer • a year ago


Probably not possible on most/any browser. Browsers try to limit how much control JS has over
the browser behavior; this is for both security and user experience reasons.
5 • Reply • Share ›

Vinicius Monteiro > Developer • a year ago


You can use return false too.
1 • Reply • Share ›

Anon > Developer • 10 months ago


Well, I clicked on the text container before pressing F11 and it didnt go full screen so I hope
that'll help.
• Reply • Share ›

kavitha • 4 years ago


% and left arrow gives key code as 37. how to differenciate
10 • Reply • Share ›

Sebastian > kavitha • a year ago


If it's the Shift-5 % rather than the numpad %, you can check e.shiftKey where e is the first
parameter of an event callback.
4 • Reply • Share ›

tomy • 3 years ago


Also, for game systems!

WII:
Platform: "Nintendo Wii"
Up: 175 (CAUTION! ALSO SCROLLS UP)
Down: 176 (CAUTION! ALSO SCROLLS DOWN)
Left: 178 (CAUTION! ALSO SCROLLS LEFT)
Right: 177 (CAUTION! ALSO SCROLLS RIGHT)
-: 170 (CAUTION! ALSO ZOOMS OUT)
+: 174 (CAUTION! ALSO ZOOMS IN)
1: 172
2: 173 (CAUTION! ALSO SPLITS SCREEN INTO SINGLE COLUMN MODE)
PS3:
Platform: "PLAYSTATION 3"

3 of 4 11/12/14 17:47
Javascript Char Codes (Key Codes) - Cambia Research http://www.cambiaresearch.com/articles/15/javas...

Copyright © Cambia Research 2002-2012. All rights reserved.


Contact me at steve at cambiaresearch d o t c o m.

4 of 4 11/12/14 17:47

You might also like