shiftkey 마우스 이벤트 속성은 마우스 버튼을 클릭할 때 SHIFT 키를 눌렀는지 여부를 표시하는 데 사용됩니다.
예시
다음 코드를 실행하여 shiftKey 구현 방법을 배울 수 있습니다. JavaScript의 마우스 이벤트.
<!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>