Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

keyCode property

Gets the numeric key code of a key that is pressed.

Document Object Model (DOM) Level 3 Events Specification, Section 5.2.6Internet Explorer 9

Syntax

HRESULT value = object.get_keyCode(* p);

Property values

Type: long

The numeric code of the key that is pressed.

Standards information

Remarks

The IDOMKeyboardEvent::keyCode property represents the character code during the HTMLFrameSiteEvents::onkeypress event and the unmodified scan code of the key during HTMLFrameSiteEvents::onkeydown and HTMLFrameSiteEvents::onkeyup events. To detect whether the Alt, Ctrl, Meta, or Shift key is also pressed, see the IDOMKeyboardEvent::altKey, IDOMKeyboardEvent::ctrlKey, IDOMKeyboardEvent::metaKey, or IDOMKeyboardEvent::shiftKey property of the event.

The IDOMKeyboardEvent::keyCode property is provided for compatibility only. The latest version of the Document Object Model (DOM) Events specification defines a IDOMKeyboardEvent::key property instead.

See also

Reference
IDOMKeyboardEvent::char
IDOMKeyboardEvent::charCode
IDOMKeyboardEvent::key
IDOMKeyboardEvent::which

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.