altKey Ereigniseigenschaften
Definition und Verwendung
altKey Ereignisattribut gibt einen Booleschen Wert. Geben Sie, wenn ein bestimmtes Ereignis eintritt, wird Alt-Taste gedrückt und halten.
Grammatik
event.altKey=true|false|1|0
Beispiele
Beispiele
Im folgenden Beispiel wird aufgefordert, wenn die Maustaste gedrückt wird "ALT" -Taste gedrückt wird, ob:
<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>
<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>
Versuchen »
Ereignisobjekte