asp.net.ph

onkeypress Event

DHTML Events


Fires when a key is pressed and released over an element.

Syntax

Inline HTML <element onkeypress = "handler" ... > All platforms
Event property object.onkeypress = handler ECMA-262 Language Specification
Named script <script FOR=object EVENT=onkeypress> Internet Explorer® only

Remarks

Bubbles Yes
Cancels Yes
To invoke Press a keyboard key.
Default action Returns a number specifying the Unicode value of the key that was pressed.

Setting event.returnValue=false has no effect on keyboard events used for navigation, on hot keys assigned to the browser, or on system events. The following keys cannot be canceled: TAB, F1 through F12, HOME, END, ESC, DELETE, and the arrow keys.

Event Object Properties

While event handlers in the Document Object Model do not receive parameters directly, the handler can query the event object for data.

Event Object Properties


Example

The onkeypress example shows how to retrieve information from the shiftKey property of the event object.

Sample Code


Applies To

This attribute may be used with most elements.

See Also

onchange, onkeydown, onkeyup



Contents
HTML Elements
HTML Element Attributes
CSS Properties
DOM Events Reference

Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note