Use String.fromCharCode to convert key event code to key event char (IE) : Key Event « Event « 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 » Event » Key Event 




<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
function press()
{
    var char;
    char = String.fromCharCode(event.keyCode);
    window.status = "You pressed " char;
}
//  -->
</script>
</head>
<body onkeydown="press()">

</body>
</html>














15.7.Key Event
15.7.1.onkeydown key event handler
15.7.2.onkeyup key event handler
15.7.3.onkeypress key event handler
15.7.4.Display key event code in status bar (IE)
15.7.5.Use String.fromCharCode to convert key event code to key event char (IE)
15.7.6.Get key code
15.7.7.Get key char
15.7.8.Is Control pressed during the event
15.7.9.Is Alt pressed during the event
15.7.10.Is the Shift pressed during the event
15.7.11.Keystroke detector
15.7.12.Focus lost event
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.