A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://webplatform.github.io/docs/dom/KeyboardEvent/shiftLeft below:

shiftLeft ยท WebPlatform Docs

shiftLeft

Property of dom/KeyboardEventdom/KeyboardEvent

Syntax
var result = element.shiftLeft;
element.shiftLeft = value;
Examples

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>

View live example

Notes Remarks

The Document must have focus for this property to return true.

Syntax Attributions

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