알트키 마우스 이벤트 속성은 마우스 버튼 클릭 시 SHIFT 키가 눌렸는지 여부를 표시하는 데 사용됩니다.
예시
다음 코드를 실행하여 altKey 구현 방법을 배울 수 있습니다. JavaScript의 마우스 이벤트.
<!DOCTYPE html>
<html>
<body onmousedown="funcAltKey(event)">
<div>Press and hold ALT key and then click here.</div>
<script>
function funcAltKey(event) {
if (event.altKey) {
alert("ALT key: Pressed");
} else {
alert("ALT key: NOT Pressed");
}
}
</script>
</body>
</html>