Typewriter
Keyboard Test Program
The purpose of this program is to find and demonstrate a method of determining which key was pressed, to keep track of keys that are down, and to eliminate auto repeat key input, in order to provide key and key combinations for control and selection of functions in programs that would benefit from keyboard control.
D: indicates keydown events.
P: indicates keypress events.
U: indicates keyup events.
Keys down: keyCode + "L" + location.
preventDefault prevents default actions on both keydown and keyup events. One of the default actions prevented by preventDefault on keydown is the keypress event!
Not all default actions can be prevented and this varies by browser.
This program uses keycode to identify keys because charCode is not always available and does not come with location information. Unfortunately, the values of keyCode are not consistent between browsers! Some small errors occur in certain browsers.
If you only use your keyboard, "change state" key indicator lights will match your keyboard. If you use your mouse the shift key works as a shift lock.
Characters produced in the window of the "typewriter" are mapped in the program, characters in the "keyboard event list" are from the charCode value received from keypress events.
Warning! When you are done playing with this program check the NUMLOCK, and CAPSLOCK on you keyboard to make sure they are in the state you want!
Keyboard event list