Hi David_Ross
the event.keyCode function return a 65 for a character 'a'
the myString.charCodeAt(0) function return a 97 for a
character 'a'
What I was looking for is a function similar to that of charCodeAt but will return the same numberic value as that of the function event.keyCode
=====================================
Code:
function convert_to_keycode()
{
myString = input_key.value
alert(myString.charCodeAt(0))
}
function show_key_value()
{
alert(event.keyCode)
}
<LABEL for="Event Key Code Number" tabindex="3">Alphanumeric input:</LABEL>
<INPUT type="text" name="input_key" maxlength=16 onkeyup='validate_alphanumeric_input(input_key)'>
<INPUT type="button" value="convert a value to key code" onclick="convert_to_keycode(input_key)">
<BR>
<BR>
<LABEL for="Event Key Code Number" tabindex="3">Keyboard input:</LABEL>
<INPUT type="text" id="Keyboard" maxlength=4 onkeyup='show_key_value()'>
Report this post to a moderator