ctrlLeft property (event)
| A A | Font size |
|
|
Share |
|
Sets or retrieves whether the left CTRL key was down at the time when the event occurred.
If it is not necessary to know which CTRL key was pressed, use the cross-browser ctrlKey property.
Syntax:
You can find the related objects in the Supported by objects section below.
The ctrlLeft property is read-only for the window.event object, but it is read/write for event objects created by the createEventObject method.
Possible values:
Boolean, one of the following values:
| Left CTRL key is up. | ||||||
| Left CTRL key is down. |
Default: this property has no default value.
Example HTML code 1:
This example illustrates the use of the ctrlLeft property:
|
|
||||
<head> <script> function GetCtrlState (event) { if (event.ctrlKey) { if (event.ctrlLeft != undefined) { if (event.ctrlLeft) { alert ("Left Ctrl key is down."); } else { alert ("Right Ctrl key is down."); } } else { alert ("Ctrl key is down."); } } else { alert ("Ctrl key is up."); } } </script> </head> <body> Press or release the left or right CTRL key before you click on the button. <br /> <button onclick="GetCtrlState (event);">Get Ctrl keys state!</button> </body> |
||||
|
||||
|
Did you find this example helpful?
|
Supported by objects:
Related pages:
External links:
User Contributed Comments

