onkeypressonkeypress*
*Contents  *Index  *Topic Contents
*Previous Topic: onkeydown
*Next Topic: onkeyup

onkeypress

Description

Fires when a user presses a key.

Return Value

Returns a number specifying the Unicode value of the key that was pressed.

Remarks

The return value can be used to override the keycode value. This event will bubble. Events that bubble can be handled on any parent element of the object that fired the event.

To cancel the keystroke, use the following code in the onkeypress event:

event.returnValue=false;

Applies To

A, ACRONYM, ADDRESS, APPLET, AREA, B, BIG, BLOCKQUOTE, BODY, BUTTON, CAPTION, CENTER, CITE, CODE, DD, DEL, DFN, DIR, DIV, DT, EM, FIELDSET, FONT, FORM, H1, H2, H3, H4, H5, H6, HR, I, IMG, INPUT, KBD, LABEL, LEGEND, LI, LISTING, MAP, MARQUEE, MENU, OBJECT, OL, P, PLAINTEXT, PRE, Q, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR, XMP, document

See Also

onchange


Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.