Key (Object)
Top  Previous  Next



This Object allows access to various Keyboard status functions and constants without a constructor.

Methods
Description
Key.getAscii()
Returns the ASCII value of the last key pressed.
Key.getCode()
Returns the virtual key code of the last key pressed.
Key.isDown()
Returns true if the key specified in the parameter is pressed.
Key.isToggled()
Returns true if the Num Lock or Caps Lock key is activated.


Properties

Key.BACKSPACE
Code constant associated with the Backspace key (8).
Key.CAPSLOCK
Code constant associated with the Caps Lock key (20).
Key.CONTROL
Code constant associated with the Control key (17).
Key.DELETEKEY
Code constant associated with the Delete key (46).
Key.DOWN
Code constant associated with the Down Arrow key (40).
Key.END
Code constant associated with the End key (35).
Key.ENTER
Code constant associated with the Enter key (13).
Key.ESCAPE
Code constant associated with the Escape key (27).
Key.HOME
Code constant associated with the Home key (36).
Key.INSERT
Code constant associated with the Insert key (45).
Key.LEFT
Code constant associated with the Left Arrow key (37).
Key.PGDN
Code constant associated with the Page Down key (34).
Key.PGUP
Code constant associated with the Page Up key (33).
Key.RIGHT
Code constant associated with the Right Arrow key (39).
Key.SHIFT
Code constant associated with the Shift key (16).
Key.SPACE
Code constant associated with the Spacebar (32).
Key.TAB
Code constant associated with the Tab key (9).
Key.UP
Code constant associated with the Up Arrow key (38).



Additional key codes (PC keyboard only, may not be available or different on other platforms).

F1 returns code 112 *

F2 returns code 113

F3 returns code 114

F4 returns code 115

F5 returns code 116

F6 returns code 117

F7 returns code 118

F8 returns code 119

F9 returns code 120

F10 returns code 121 *

F11 returns code 122

F12 returns code 123

* Some Function Keys are not available as the operating system uses them to invoke special functions. eg on WinXP F1 is used to open help file. Some function keys may also have browser assigned functions and will hence not be available for use with specific browsers.

Num Lock 144

Pause / Break 19

Scroll Lock 145

Print Scrn 44