<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <script>
        window.onload = function() {
            var result = document.getElementById("result");
            
            var inp = document.getElementsByTagName("input")[0];

            inp.addEventListener("keydown", function(e) {
              //e.preventDefault();
              result.innerHTML += "<br>" + e.type;
            }, false);

            inp.addEventListener("keypress", function(e) {
               //e.preventDefault();
               result.innerHTML += "<br>" + e.type;
            }, false);

            inp.addEventListener("keyup", function(e) {
                result.innerHTML += "<br>" + e.type;
            }, false);

        };
        </script>
    </head>
    <body>
        <p>Type text or non-text key to see what happens <input></p>
        <p id="result"></p>
    </body>
</html>