Latest web development tutorials

Alt 키의 이벤트 속성

이벤트 객체 참조 이벤트 객체

정의 및 사용

Alt 키 이벤트 속성은 부울 값을 반환합니다. 특정 이벤트가 발생하면, Alt 키가 눌려 나타내며 잡아.

문법

event.altKey=true|false|1|0


다음 예는 마우스 버튼을 클릭 할 때 "ALT"키가 있는지 여부를 누르면 프롬프트

<html>
<head>
<script>
function isKeyPressed(event)
{
if (event.altKey==1)
{
alert("The ALT key was pressed!")
}
else
{
alert("The ALT 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 ALT key or not.</p>

</body>
</html>

»시도


이벤트 객체 참조 이벤트 객체