Freigeben über


Sys.UI.DomEvent charCode Field

Gets the character code of the key that raised the associated keyPress event.

var charCode = domEventVar.charCode;

Return Value

An integer value that represents the character code of the key or key combination that was pressed to raise the keyPress event.

Remarks

Use the charCode field to get the character code of a pressed key or key combination that raised a keyPress event. The keyPress event provides a single character code that identifies key combinations. The keyPress event is not raised for single modifier keys such as ALT, CTRL, and SHIFT.

Note

To get the key code of each key that was pressed to raise a keyUp or keyDown event, use the Sys.UI.DomEvent.keyCode field instead of the charCode field. The keyUp or keyDown events are raised for every key, even modifier keys such as ALT, CTRL, and SHIFT. For key combinations such as CTRL+Z, the keyCode field reflects whichever key first raised the keyUp or keyDown event.

See Also

Reference

Sys.UI.DomEvent Class

Other Resources

Language Reference