www.fgks.org   »   [go: up one dir, main page]

Click to Rate and Give Feedback
Properties
 shiftKey Property
shiftKey Property

Retrieves the state of the SHIFT key.

Syntax

[ bKey = ] event.shiftKey

Possible Values

bKeyBoolean that receives one of the following values.
falseSHIFT key is not pressed.
trueSHIFT 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.

Example

This example demonstrates how to retrieve the state of the SHIFT key. Any key pressed fires the onkeydown event handler, enabling you to retrieve the state of the SHIFT key. The onkeyup event handler returns true when any key is pressed and released while the SHIFT key is pressed. Whenever the SHIFT key is released, the event handler returns false. The onkeypress event handler only fires when the user presses an alphanumeric key—it will not fire if the SHIFT key is pressed.

<HTML>
.
.
.        
<BODY  
      
      >

State of SHIFT key from the onkeydown event handler: 
<SPAN id="okd" class="b"></SPAN><BR>
State of SHIFT key from the onkeyup event handler: 
<SPAN id="oku" class="b"></SPAN><BR>
State of SHIFT key from the onkeypress event handler: 
<SPAN id="okp" class="b"></SPAN>
.
.
.
</BODY>
</HTML>
This feature requires Microsoft® Internet Explorer 4.0 or later. Click the following icon to install the latest version. Then reload this page to view the sample.

Standards Information

There is no public standard that applies to this property.

Applies To

event

See Also

shiftLeft
Tags What's this?: Add a tag
Community Content
 
Add Community Content
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker
DCSIMG