T
Thomas Christensen
I'm trying to figure out what key the user pressed using a Danish
keyboard layout. charCodeAt returns the correct number, but
event.keyCode returns a wrong number, when using one of the keys that
are different on a Danish keyboard layout. "-" returns 45 and 189
respectively. Etc. (The input-field in the sample code below displays
the right character).
I've tried setting the lang-parameter to 'da', but it doesn't make a
difference.
sample code:
<input type="text"
onkeyup="alert(this.value.charCodeAt(this.value.length-1));alert(window.event.keyCode);">
Am I missing something, or is the event.keyCode in IE hardcoded to an
english keyboard layout? Is there a way to automatically convert the
event.keyCode so it corresponds with the users keyboard?
Thomas
keyboard layout. charCodeAt returns the correct number, but
event.keyCode returns a wrong number, when using one of the keys that
are different on a Danish keyboard layout. "-" returns 45 and 189
respectively. Etc. (The input-field in the sample code below displays
the right character).
I've tried setting the lang-parameter to 'da', but it doesn't make a
difference.
sample code:
<input type="text"
onkeyup="alert(this.value.charCodeAt(this.value.length-1));alert(window.event.keyCode);">
Am I missing something, or is the event.keyCode in IE hardcoded to an
english keyboard layout? Is there a way to automatically convert the
event.keyCode so it corresponds with the users keyboard?
Thomas