下面的例子可提示当鼠标按键被点击时 "CTRL" 键是否被按住:
</>code
- <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>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛
Powered by 365建站网 RSS地图 HTML地图
copyright © 2013-2024 版权所有 鄂ICP备17013400号