Re: What's wrong with keyCode and String.fromCharCode
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: What's wrong with keyCode and String.fromCharCode

From: VK <schools_ring@yahoo.com>
Date: Mon Feb 27 2006 - 18:51:44 CET

Pugi! wrote:
> It is example of adding an eventlistener to a textarea. The events works
> alright, but when I press 'a' the alert gives me 'A', when I press '8' I get
> 'h', when I press '0' I get ''', when I press 'à' I get '0', ....
> Has probably something to do with the fact that I don't live in the UK or
> USA. But it shouldn't matter; a key is a key.

No it's not ;-) Do not mix keyboard *scancodes* with *keycode*.
Scancode is the system value assigned to each key on your keyboard.
This value is indead layout-independent. Keycode is Unicode value going
to receiver: it depends on current layout, shift state etc.

In your particular case though it may help to monitor 'okeypress'
instead of 'onkeydown' as you're doing right now.
Received on Mon May 1 03:39:53 2006