Onkeypress event In Java Script

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.


<title>events </title>


<body bgcolor=green text=yellow>

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


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


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


function ff()


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





Scroll to Top