Latest web development tutorials

sifat acara altKey

Acara Referensi Obyek benda acara

Definisi dan Penggunaan

altKey atribut acara mengembalikan nilai Boolean. Menunjukkan bila peristiwa tertentu terjadi, tombol Alt ditekan dan tahan.

tatabahasa

event.altKey=true|false|1|0


contoh

contoh

Contoh berikut meminta ketika tombol mouse diklik "ALT" tombol ditekan apakah:

<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>

Coba »


Acara Referensi Obyek benda acara