Gets the numeric key code of a key that is pressed.
HRESULT IDOMKeyboardEvent::get_charCode(long *p);
- Pointer to a variable of type long that receives the numeric code of the key that is pressed.
Returns S_OK if successful, or an error value otherwise.
The charCode 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 charCode property is provided for compatibility only. The latest version of the Document Object Model (DOM) Events specification defines a key property instead.