Visit Mozilla.org

DOM:event.altKey

From MDC

« Gecko DOM Reference

[edit] Summary

Indicates whether the ALT key was pressed when the event fired.

[edit] Syntax

bool = event.altKey

bool contains true or false, depending on whether the alt key was held down or not, when the event fired.

[edit] Example

<html>
<head>
<title>altKey example</title>

<script type="text/javascript">

function showChar(e){
  alert(
    "Key Pressed: " + String.fromCharCode(e.charCode) + "\n"
    + "charCode: " + e.charCode + "\n"
    + "ALT key pressed: " + e.altKey + "\n"
  );
}

</script>
</head>

<body onkeypress="showChar(event);">
<p>
Press any character key,
with or without holding down the ALT key.<br />
You can also use the SHIFT key together with the ALT key.
</p>
</body>
</html>