Property of dom/KeyboardEventdom/KeyboardEvent
Syntaxvar result = element.altLeft;
element.altLeft = value;
Examples
The following example shows how to use the altLeft property to indicate when the user presses the left or right ALT keys.
<HEAD>
<SCRIPT>
function init() {
spanLeftAlt.innerText='false';
spanRightAlt.innerText='false';
}
function indicate(obj, arg) {
obj.innerText=arg;
}
function AltDown() {
if (event.altLeft) {
indicate(spanLeftAlt,'true');
}
else {
if (event.altKey) {
indicate(spanRightAlt,'true');
}
}
}
function AltUp() {
if (!event.altKey) {
indicate(spanLeftAlt,'false');
indicate(spanRightAlt,'false');
}
}
</SCRIPT>
</HEAD>
<BODY onload="document.body.focus(); init()" onkeydown="AltDown();" onkeyup="AltUp();">
<P>Press either the left or right ALT key.</P>
<TABLE>
<TR>
<TD><I>Left ALT Key Pressed</I></TD>
<TD><I>Right ALT Key Pressed</I></TD>
</TR>
<TR>
<TD ALIGN="center"><SPAN ID="spanLeftAlt"></SPAN></TD>
<TD ALIGN="center"><SPAN ID="spanRightAlt"></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. No altRight property is available. Authors can test for the right ALT key by using the altKey and altLeft properties.
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