Property of dom/KeyboardEventdom/KeyboardEvent
Syntaxvar result = element.ctrlLeft;
element.ctrlLeft = value;
Examples
The following example shows how to use the ctrlLeft property to indicate when the user presses the left or right CTRL keys.
<HEAD>
<SCRIPT>
function init() {
spanLeftCtrl.innerText='false';
spanRightCtrl.innerText='false';
}
function indicate(obj, arg) {
obj.innerText=arg;
}
function CtrlDown() {
if (event.ctrlLeft) {
indicate(spanLeftCtrl,'true');
}
else {
if (event.ctrlKey) {
indicate(spanRightCtrl,'true');
}
}
}
function CtrlUp() {
if (!event.ctrlKey) {
indicate(spanLeftCtrl,'false');
indicate(spanRightCtrl,'false');
}
}
</SCRIPT>
</HEAD>
<BODY onload="document.body.focus(); init()" onkeydown="CtrlDown();" onkeyup="CtrlUp();">
<P>Press either the left or right CTRL key.</P>
<TABLE>
<TR>
<TD><I>Left CTRL Key Pressed</I></TD>
<TD><I>Right CTRL Key Pressed</I></TD>
</TR>
<TR>
<TD ALIGN="center"><SPAN ID="spanLeftCtrl"></SPAN></TD>
<TD ALIGN="center"><SPAN ID="spanRightCtrl"></SPAN></TD>
</TR>
</TABLE>
</P>
</BODY>
Notes Remarks
This property is currently supported only in Microsoft Windows NT 4.0 and Windows 2000. The Document must have focus for this property to return true.
Syntax AttributionsMicrosoft Developer Network: [Windows Internet Explorer API reference Article]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4