Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Textarea onKeyPress

The onKeyPress event handler is fired when a key is pressed within the text area. <html>     <head>     <script language="JavaScript1.2">     <!--     function showDialog(type){       alert("An onKey" + type + " event just occurred");     }     -->     </script>     </head>     <body>     <form name="myForm">       <textarea name="myTextArea" rows=2 cols=50                 onKeyDown='showDialog("Down")'                 onKeyPress='showDialog("Press")'>       Here is some text in my text area.       </textarea>     </form>     </body>     </html>