Onkeypress event In Java Script

0
6
This event gets fired when the key is pressed from keyboard and the hand from the key gets removed. This event even can sense the shift or alt key pressed while onkeydown event is unable to sense these special keys. So many key combinations can be made using this event or the menu shortcut keys can be programmed using this key event.
 
Example:
 
<html>

<head>

<title>events </title>

</head>

<body bgcolor=green text=yellow>

<h4 align =center> Type character in the textbox </h4>

<blockquote>

You will notice that the dialogbox appears   before the character appears in the textbox

</blockquote>

name : <input type=”text” name=”t1″ onkeypress=”ff()”>

<script>

function ff()

{

alert(“ASCII Code of the key you pressed :”+   event.keyCode)

}

</script>

</body>

</html>