반응형
Definition and Usage
The ctrlKey event attribute returns a Boolean value that indicates whether or not the "CTRL" key was pressed when an event was triggered.
Syntax
event.ctrlKey=true|false|1|0<html>
<head>
<script type="text/javascript">
function isKeyPressed(event)
{
if (event.ctrlKey==1)
{
alert("The CTRL key was pressed!");
}
else
{
alert("The CTRL 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 CTRL key or not.</p>
</body>
</html>
반응형
'프로그래밍 > Script' 카테고리의 다른 글
[jQuery] jQuery Alert Dialogs (Alert, Confirm, & Prompt Replacements) (0) | 2011.07.01 |
---|---|
[javascript] 왜 jQuery 인가? (0) | 2011.06.30 |
[javascript] loopedSlider (0) | 2011.06.24 |
[App] Episode - 아이패드용 매거진 Pleiades Corp. (0) | 2011.05.19 |
[javascript] Creating a Mobile Touch Slide Panel with JQuery (0) | 2011.05.19 |