Program:
Output:
<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: