onKeyDown

Arguments

eventKeyboardEvent Object

An object that contains information about the keyboard event, such as the key that was pressed. The properties available to you in this object are defined and set by the client's browser.

Description

This event fires when the user types a character in an editable field. The event fires on the press down of the key.

Discussion

The onKeyDown event fires when the user presses down a key on the keyboard when an element has focus. It is the first keyboard event to fire when the user presses a key. This event can be used to execute an Action Javascript, custom JavaScript, or server-side Xbasic to perform an action. For example, you may want to run some JavaScript when the user hits the Enter key.

if (event.keyCode == 13) {
   // Enter key has been pressed
}

For more information about keyboard events, see Mozilla's documentation on KeyboardEvents or the developer documentation for your favorite web browser.

See Also