shiftKey property (event)
Sets or retrieves a Boolean value that indicates whether the left or right SHIFT key was down at the time when the event occurred.
In Internet Explorer, use the shiftLeft property to detect whether the left or right SHIFT key is down.
Syntax:
You can find the related objects in the Supported by objects section below.
The shiftKey property is read-only, except if the event object is created with the createEventObject method when it is read/write.
Possible values:
Boolean that sets or retrieves the state of the SHIFT key.
One of the following values:
SHIFT key is up. | |||||||
SHIFT key is down. |
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the shiftKey property:
|
||||
<head> <script type="text/javascript"> function GetShiftState (event) { if (event.shiftKey) { alert ("Shift key is down."); } else { alert ("Shift key is up."); } } </script> </head> <body> Press and hold down the SHIFT key before you click on the button. <br /> <button onclick="GetShiftState (event);">Get Shift key state!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments