Key Event Handling
The onkeydown event
It's handy to allow users to control your Web page via their keyboard as well as via their mouse. With the key event handlers, you can trigger events to happen when the appropriate keys are pressed. In Scripts 9.19 and 9.20, a standard slideshow (otherwise identical to the one in Script 4.17) can be viewed by pressing the left and right arrow keys on the keyboard (Figure 9.9).
Script 9.19. The HTML for the slideshow.
Script 9.20. Use the onkeydown handler in this script to trigger a slide change.
Figure 9.9. This slideshow is controlled with keypresses, rather than mouse clicks on navigation buttons.
The onkeyup event
The onkeypress event
The onkeypress event is triggered when the user both presses a key down and also lets the key back up againjust for completeness's sake.