'keyCode' Example : keyCode « Javascript Properties « JavaScript Reference

'keyCode' Example

    
<html>
<body>
<script language="JavaScript">
    function function1() {
        x = event.keyCode; alert("Unicode Value: "+x);
    }
    function function2() {
        x = event.keyCode; alert("Keyboard Value: "+x);
    }
</script>
<p>Press Any Key While The Browser is in Focus</p>
<body onKeyDown="function2();" onKeyPress="function1();">
</body>
</html>

    
      
      








Related examples in the same category

1.'keyCode' Syntax and Note
2.'keyCode' is applied to