案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function isKeyPressed(event)
5
{
6
  if (event.ctrlKey==1)
7
    {
8
    alert("The CTRL key was pressed!")
9
    }
10
  else
11
    {
12
    alert("The CTRL key was NOT pressed!")
13
    }
14
  }
15
16
</script>
17
</head>
18
<body onmousedown="isKeyPressed(event)">
19
20
<p>Click somewhere in the document. An alert box will tell you if you pressed the CTRL key or not.</p>
21
22
</body>
23
</html>
24