Event.KEYDOWN

JavaScript 1.2+ Nav4+ Syntax

Event.KEYDOWN

Description

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

Example

Listing 7.225 shows an example of how a JavaScript function can use the KEYDOWN event to determine if a key was pressed down. When the KEYDOWN event is captured, the handle() function processes the event and informs the user that a key has been pressed down.

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

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.