23 Create a JavaScript to show Key Events and specific which event has been occurred.

Program:

<html>

<body>
    <form name="f1">
        <input type="button" name="key" value="key Events"><br><br>
        <input onkeyup="up()" onkeydown="down()">
        <input onkeypress="press()" onkeydown="down()">
    </form>
</body>
<script>
    function down() {
        document.f1.key.value = "Key Down"
    }
    function press() {
        document.f1.key.value = "Key Press "
    }
    function up() {
        document.f1.key.value = "Key Up"
    }
</script>

</html>


Output:

key event javascript

Previous
Next Post »