This example demonstrates how to retrieve the state of the SHIFT key. Press any key and the onkeydown event handler fires, enabling you to retrieve the state of the SHIFT key. Because the onkeyup event handler only fires when a key is released, it always returns false for the SHIFT key's state. The onkeypress event handler only fires when the user presses an alphanumeric key—it does not fire if the SHIFT key is pressed.
[Right-click and choose View Source from the shortcut menu.]
© 2007 Microsoft Corporation. All rights reserved. Terms of use.