Javascript DOM HTML Body handle mouse down event

Description

Javascript DOM HTML Body handle mouse down event

View in separate window

<!DOCTYPE html>
<html>
<body onmousedown="isKeyPressed(event)">

<p id="demo"></p>
<script>
function isKeyPressed(event) {//from ww  w.  j  ava  2s.c o m
  if (event.ctrlKey) {
    document.getElementById("demo").innerHTML = "The CTRL key was pressed!";
  } else {
    document.getElementById("demo").innerHTML = "The CTRL key was NOT pressed!";
  }
}
</script>

</body>
</html>



PreviousNext

Related