Get key char : Key Event : Event JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Event » Key Event »

 

Get key char

















<html>
<head>
<title>Key Events Example</title>
<script type="text/javascript">
function handleEvent(oEvent) {
    var oTextbox = document.getElementById("txt1");
    oTextbox.value += "n>" + oEvent.type;
    oTextbox.value += "n    target is " (oEvent.target || oEvent.srcElement).id;
    oTextbox.value += "n    charCode is " + oEvent.charCode;
}
</script>
</head>
<body>
    <P>Type some characters into the first textbox.</p>
    <P><textarea id="txtInput" rows="15" cols="50"
        onkeypress="handleEvent(event)"></textarea></p>
    <P><textarea id="txt1" rows="15" cols="50"></textarea></p>
</body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Event
» Key Event