How to indicate if the alt key was pressed in JavaScript

1 Answer

0 votes
<script type="text/JavaScript">   

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

</script>
<body onkeypress="showCharCodeandALT(event);">

 



answered May 29, 2016 by avibootz
...