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
Want To Be A Web Master?
If you want to be a Web Master, you will have to host your web site with an ISP (Internet Service Provider).
MaximumASP offers seven different configurations of dedicated servers to meet your Windows and .NET hosting needs.
Hosted on our multi-tiered Enterprise Class network, these servers provide the performance, security and reliability
you need to host your high end web sites and applications.
Visit MaximumASP
|