Convert the key code from key event to character in JavaScript
Description
The following code shows how to convert the key code from key event to character.
Example
<html>
<head>
<script type="text/javascript">
function press() {<!-- w w w. j a v a 2 s .c o m-->
var oTextbox = document.getElementById("txt1");
oTextbox.value += "\n>" + String.fromCharCode(event.keyCode);
}
</script>
</head>
<body onkeydown="press()">
<P>
<textarea id="txt1" rows="15" cols="50"></textarea>
</p>
</body>
</html>