EN
이 콘텐츠는 한국어로 제공되지 않아 영어 버전으로 표시됩니다.

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

JavaScript

p = object.keyCode

 

Property values

Type: Integer

The numeric code of the key that is pressed.

Standards information

Remarks

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

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

See also

KeyboardEvent
Reference
char
charCode
key
which

 

 

표시:
© 2014 Microsoft