Sunday, July 3, 2011

Java Script : How to get the ACSII code of pressed key ?

Use Below function and call it on the onkeypress event of your text box.
[input type='text' name='name' onkeypres='getPressedKeyASCII(event)' value='']

function getPressedKeyASCII(e){
var unicode=e.keyCode? e.keyCode : e.charCode
alert(unicode);
}

No comments:

Post a Comment