altKey,ctrlKey,shiftKey

<1>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">

    </script>
</head>
<body>

<!--altKey属性,bool类型,表示发生事件的时候alt键是否被按下-->
<!--ctrlKey属性,bool类型,表示发生事件的时候ctrl键是否被按下-->
<!--shiftKey属性,bool类型,表示发生事件的时候shift键是否被按下-->


<input type="button" value="ctrl点击" onclick="if(window.event.ctrlKey==true){alert('按下了ctrl键')} else{alert('普通点击')}" />

<input type="button" value="alt点击" onclick="if(window.event.altKey==true){alert('按下了alt键')} else{alert('普通点击')}" />


<input type="button" value="shift点击" onclick="if(window.event.shiftKey==true){alert('按下了shift键')} else{alert('普通点击')}" />
</body>
</html>


posted @ 2014-09-19 12:15  mengfanrong  阅读(332)  评论(0)    收藏  举报