Main /

Js Events

Wiki_System*

technolowiki.org

[-edit SideBar-]

Js Events

JS Keyboard Events

When the user hits the keyboard, the order of events being fired is:

  1. (on)keydown – may act upon or cancel the keystroke – the only way to catch special keys such as shift, ctrl, del – gets the key-code on event.which or event.keyCode
  2. (on)keypress – may act upon, cancel or modify (only IE) the keystroke – this event is repeated as long as the key is held down – gets the ASCII-code on event.which or event.keyCode
  3. (on)textInput – also called on clipboard paste – as of 2010, only supported by webkit browsers
  4. (on)keyup – may act upon release of the key – too late to do anything about it

Some browsers also support the event.charCode property, which will return the ASCII code of the key in ALL handlers. The DOM level 3 specs introduce the properties event.keyIdentifier, which holds a string with the key´s name, and event.keyLocation, which holds a number for the key´s placement.

Values of event.keyIdentifier

key codeshort nameDOM3 name (string)
 AcAlphanumeric
 AgainAgain
 AlCsAllCandidates
18AltAlt
93AppsApps
30AtAccept
 AtGhAltGraph
246AttnAttn
8BkSpU+000008
166BrBkBrowserBack
167BrFdBrowserForward
171BrFsBrowserFavorites
172BrHeBrowserHome
168BrRhBrowserRefresh
170BrShBrowserSearch
169BrSpBrowserStop
 CeCompose
 CeItCodeInput
17ClControl
12ClearClear
24CnclU+000018
 CopyCopy
247CrselCrsel
20CsLkCapsLock
28CtConvert
 CutCut
46DelU+00007F
40DownDown
43EeExecute
249EeEfEraseEof
35EndEnd
13EnterEnter
27EscU+00001B
248ExselExsel
112F1F1
121F10F10
122F11F11
123F12F12
124F13F13
125F14F14
126F15F15
127F16F16
128F17F17
129F18F18
130F19F19
113F2F2
131F20F20
132F21F21
133F22F22
134F23F23
135F24F24
114F3F3
115F4F4
116F5F5
117F6F6
118F7F7
119F8F8
120F9F9
 FindFind
24FlMeFinalMode
 FlWhFullWidth
 HaHiragana
 HaMeHanjaMode
47HelpHelp
 HfWhHalfWidth
 HlMeHangulMode
36HomeHome
45ItInsert
23JaMeJunjaMode
 JeHaJapaneseHiragana
 JeKaJapaneseKatakana
 JeRiJapaneseRomaji
 KaKatakana
 KaMeKanaMode
 KiMeKanjiMode
37LeftLeft
181LhAn1LaunchApplication1
182LhAn2LaunchApplication2
180LhMlLaunchMail
176MaNtTkMediaNextTrack
177MaPsTkMediaPreviousTrack
179MaPyPeMediaPlayPause
178MaSpMediaStop
31MeCeModeChange
224MetaMeta
29NtNonconvert
144NumLkNumLock
 PastePaste
19PausePause
34PeDnPageDown
33PeUpPageUp
250PlayPlay
42Print
 PropsProps
229PsProcess
 PsCePreviousCandidate
44PtSnPrintScreen
39RightRight
 RnCsRomanCharacters
16ShiftShift
145SlScroll
95Sleep
32SpaceU+000020
41StSelect
 StMaSelectMedia
 StopStop
9TabU+000009
 UndoUndo
38UpUp
174VeDnVolumeDown
173VeMeVolumeMute
175VeUpVolumeUp
91/92WinWin
251ZoomZoom

Values of event.keyIdentifier

valuekey location
0default, eg. "A"~"Z", "%" (over 5), left-shift-key
1side, eg. right-ctrl-key
2keypad, eg. "0"~"9" (numeric pad), right-enter-key
Recent Changes (All) | Edit SideBar Page last modified on September 19, 2010, at 07:13 PM Edit Page | Page History
Powered by TechnoloWiki