Code
<!DOCTYPE html>
<html>
    <head>
        <title>html tutorial - html5 - html code - html form - In 30Sec by Microsoft Award MVP - | wikitechy HTML onkeypress attribute</title>
    </head>
    <body>
        Enter the text:
        <input type="text" onkeypress="onKeyPress()">
        <script>
            function onKeyPress() {
                alert("Pressed a key inside the input field");  
            }
        
</script>  
    </body>
</html>







Result