Textarea.onKeyPress : TextArea « Form « JavaScript Tutorial

Home
JavaScript Tutorial
1.Language Basics
2.Operators
3.Statement
4.Development
5.Number Data Type
6.String
7.Function
8.Global
9.Math
10.Form
11.Array
12.Date
13.Dialogs
14.Document
15.Event
16.Location
17.Navigator
18.Screen
19.Window
20.History
21.HTML Tags
22.Style
23.DOM Node
24.Drag Drop
25.Object Oriented
26.Regular Expressions
27.XML
28.GUI Components
29.Dojo toolkit
30.jQuery
31.Animation
32.MS JScript
JavaScript Tutorial » Form » TextArea 
10.16.12.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=cols=50
                onKeyDown='showDialog("Down")'
                onKeyPress='showDialog("Press")'>
      Here is some text in my text area.
      </textarea>
    </form>
    </body>
    </html>
10.16.TextArea
10.16.1.Textarea
10.16.2.Textarea.blur()
10.16.3.Textarea.defaultValue
10.16.4.Textarea.focus()
10.16.5.Textarea.form
10.16.6.Textarea.handleEvent()
10.16.7.Textarea.name
10.16.8.Textarea.onBlur
10.16.9.Textarea.onChange
10.16.10.Textarea.onFocus
10.16.11.Textarea.onKeyDown
10.16.12.Textarea.onKeyPress
10.16.13.Textarea.onKeyUp
10.16.14.Textarea.onSelect
10.16.15.Textarea.select()
10.16.16.Textarea.type
10.16.17.Textarea.value
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.