Sunday, 17 April 2011

Determining which key is pressed using java script or Working withjavascript key codes

The following example is used to determine which key is pressed using javascript
<script type="text/javascript">
function displayunicode(e){
var unicode=e.keyCode? e.keyCode : e.charCode
alert(unicode)
}
</script>
<form>
<input type="text" size="2" maxlength="1"
onkeyup="displayunicode(event); this.select()" />
</form>

No comments:

Post a Comment