实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script>
5
function isKeyPressed(event)
6
{
7
if (event.shiftKey==1)
8
  {
9
  alert(" shift 键被按下!");
10
  }
11
else
12
  {
13
  alert(" shift 键没被按下!");
14
  }
15
}
16
</script>
17
</head>
18
19
<body onmousedown="isKeyPressed(event)">
20
21
<p>点击该段落,尝试按下或者不按下shift 键的效果。</p>
22
23
</body>
24
</html>         
25