shiftKey Event Attribute
Complete Event Object Reference
Definition and Usage
The shiftKey event attribute returns a Boolean value that indicates whether or not the "SHIFT" key was
pressed when an event was triggered.
Syntax
event.shiftKey=true|false|1|0
|
Example
The following example alerts whether or not the "SHIFT" key was pressed when
a mouse button is clicked:
<html>
<head>
<script type="text/javascript">
function isKeyPressed(event)
{
if (event.shiftKey==1)
{
alert("The shift key was pressed!")
}
else
{
alert("The shift key was NOT pressed!")
}
}
</script>
</head>
<body onmousedown="isKeyPressed(event)">
<p>Click somewhere in the document.
An alert box will tell you if you
pressed the shift key or not.</p>
</body>
</html>
|
Try-It-Yourself Demos
shiftKey - Check whether or not the SHIFT key was pressed
Complete Event Object Reference
Whether you're new to XML or already an advanced user, the user-friendly views
and powerful entry helpers, wizards, and debuggers in XMLSpy are designed to
meet your XML and Web services development needs from start to finish.
- XML editor
- Graphical XML Schema / DTD editors
- XSLT 1.0/2.0 editor, debugger, profiler
- XQuery editor, debugger, profiler
- Support for Office Open XML (OOXML)
- Graphical WSDL editor & SOAP debugger
- Java, C#, C++ code generation
- And much more!
Download a fully functional free 30-day trial today!
|