altKeyEvent Property

事件对象参考手册Event Object

Definition and Usage

The altKey event property returns a boolean value. It indicates whether the Alt key was pressed and held down when the specified event occurred.

Syntax

event.altKey=true|false|1|0


Example

Example

The following example can indicate whether the "ALT" key was held down when the mouse button was clicked:

function isKeyPressed(event){ if (event.altKey==1){ alert("ALT key was pressed!"); }else{ alert("ALT key was not pressed!"); } }

Try it yourself »


事件对象参考手册Event Object Other Extensions