HBCMS更多的中文手册参考:

shiftLeft参数属性

DHTML文档教程

Retrieves the state of the left SHIFT key.

dhtml语法

[ bPressed = ] event.shiftLeft

DHTML可能的值

bPressedBoolean that receives one of the following values.
falseLeft SHIFT key is not pressed.
trueLeft SHIFT 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

the document must have focus for this property to return true.

DHTML代码范例

The following example shows how to use the shiftLeft property to indicate when the user presses the left or right SHIFT keys.

<HEAD>
<SCRIPT>
function init() {
spanLeftShift.innerText='false';
spanRightShift.innerText='false';
}
function indicate(obj, arg) {
obj.innerText=arg;
}
function ShiftDown() {
if (event.shiftLeft) {
indicate(spanLeftShift,'true');
}
else {
if (event.shiftKey) {
indicate(spanRightShift,'true');
}
}
}
function ShiftUp() {
if (!event.shiftKey) {
indicate(spanLeftShift,'false');
indicate(spanRightShift,'false');
}
}
</SCRIPT>
</HEAD>
<BODY onload="document.body.focus(); init()" onkeydown="ShiftDown();" onkeyup="ShiftUp();">
<P>Press either the left or right SHIFT key.</P>
<TABLE>
<TR>
<TD><I>Left SHIFT Key Pressed</I></TD>
<TD><I>Right SHIFT Key Pressed</I></TD>
</TR>
<TR>
<TD ALIGN="center"><SPAN ID="spanLeftShift"></SPAN></TD>
<TD ALIGN="center"><SPAN ID="spanRightShift"></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

event

更多语法参考

shiftKey