• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

The Keyboard

Working with the keyboard is much like working with the mouse—the difficulty is in handling the different event models. There are only three keystroke events. Here they are, in the order in which they occur, and what they do:

  • onkeydown. Occurs when a key is struck or is held down and repeats (along with onkeyup) when you hold it down. Internet Explorer: event.keyCode holds the key’s key code. Netscape Navigator: event.keyCode holds the key code and event.charCode holds zero.

  • onkeypress. Occurs after the onkeydown and before the onkeyup event when you press an alphanumeric key, as well as ! @ # $ % ^ & * ( ) _ − + = < [ ] { } , . / ? \ | ‘ ` “ ~ Esc, Spacebar, and Enter. Internet Explorer: event.keyCode holds the key’s character code. Netscape Navigator: event.charCode holds the character code and event.keyCode holds zero.

  • onkeyup. Occurs when a key is released or is held down and repeats (along with onkeydown) when you hold a key down. Internet Explorer: event.keyCode holds the key’s key code. Netscape Navigator: event.keyCode holds the key code and event.charCode holds zero.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint