JavaScript中shiftKey鼠标事件的作用是什么?
shiftkey鼠标事件属性用于显示在鼠标按钮单击时是否按下SHIFT键。
示例
你可以尝试运行以下代码以了解如何在JavaScript中实现shiftKey 鼠标事件。
<!DOCTYPE html>
<html>
<body onmousedown = "funcShiftKey(event)">
<div>Press and hold SHIFT key and then click here.</div>
<script>
function funcShiftKey(event) {
if (event.shiftKey) {
alert("SHIFT key: Pressed");
} else {
alert("SHIFT key: NOT Pressed");
}
}
</script>
</body>
</html>
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C语言编程
C++
C#
MongoDB
MySQL
Javascript
PHP