HTML Canvas Key event

Description

HTML Canvas Key event

View in separate window

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Keyboard Events</title>
  </head>//from w  ww .jav a2 s. c om
  <body>
    <aside>Open debugging console in web browser and press key.</aside>
    
    <script>
    window.onload = function () {

      function onKeyboardEvent (event) {
        console.log(event.type);
      }

      window.addEventListener('keydown', onKeyboardEvent, false);
      window.addEventListener('keyup', onKeyboardEvent, false);
    };
    </script>
  </body>
</html>



PreviousNext

Related