04.11.2015 Views

javascript

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 12: Events<br />

Key Key Code Key Key Code<br />

Home 36 F7 118<br />

Left Arrow 37 F8 119<br />

Left Arrow (Safari < 3) 63234 F9 120<br />

Up Arrow 38 F10 121<br />

Up Arrow (Safari < 3) 63232 F11 122<br />

Right Arrow 39 F12 123<br />

Right Arrow (Safari < 3) 63235 Num Lock 144<br />

Down Arrow 40 Scroll Lock 145<br />

Down Arrow (Safari < 3) 63233 Semicolon (IE/Safari/Chrome) 186<br />

Ins 45 Semicolon (Opera/FF) 59<br />

Del 46 Less - than 188<br />

Left Windows Key 91 Greater - than 190<br />

Right Windows Key 92 Forward slash 191<br />

Context Menu Key 93 Grave accent (`) 192<br />

Numpad 0 96 Equals 61<br />

Numpad 1 97 Left Bracket 219<br />

Numpad 2 98 Back lash (\) 220<br />

Numpad 3 99 Right Bracket 221<br />

Numpad 4 100 Single Quote 222<br />

Numpad 5 101<br />

H ere are a few oddities regarding the keydown and keyup events:<br />

❑<br />

❑<br />

❑<br />

❑<br />

Firefox and Opera return 59 for the keyCode of the semicolon key, which is the ASCII code for a<br />

semicolon, whereas IE and Safari return 186, which is the code for the keyboard key.<br />

Safari prior to 3 returned numbers above 63000 for the up, down, left, and right arrow keys as<br />

well as the page up and page down keys.<br />

Opera prior to 9.5 set the keyCode for nonalphanumeric keys equal to the character ’ s ASCII<br />

code, so the less - than key returned 44 instead of 188. This affects all keys that produce a<br />

nonalphanumeric character.<br />

Safari prior to version 3 doesn ’ t fire keydown or keyup events for Tab, Shift, Ctrl, or Alt.<br />

394

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!