Retrieves a value that indicates the state of the left ALT key.
dhtml语法
[ bPressed = ] event.altLeft
DHTML可能的值
bPressed | Boolean that
receives one of the following values.false | Left ALT key is not pressed. | true | Left ALT key is pressed. |
|
The property is read-only.
The property has no default value.
Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see about dynamic properties.
remarks
this property is currently supported only in microsoft® windows nt® 4.0 and microsoft 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.
DHTML代码范例
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>
This feature requires Microsoft® Internet Explorer 5.5 or later. Click the following icon to install the latest version. Then reload this page to view the sample.
是否符合公共标准
There is no public standard that applies to this property.
Applies To
更多语法参考
altKey