Event.KEYPRESS

JavaScript 1.2+ Nav4+ Syntax

Event.KEYPRESS

Description

The KEYPRESS property of the Event object is used by documents, images, links, and text area form elements to indicate when a key is pressed and held by the user.

Example

Listing 7.226 shows how the KEYPRESS property is used to determine when a key has been pressed. When the KEYPRESS event is captured, it is sent to the handle() function, which informs the user that a key has been pressed.

Listing 7.226 Accessing the KEYPRESS Object
 <html> <head> <title>Example of Event.KEYPRESS</title> </head> <body> <script language="JavaScript"> <!--Hide // sets up the window to capture KEYPRESS events window.captureEvents(Event.KEYPRESS); // function that handles the specific ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.