I try to convert keystrokes into chracters.
In other question someone recommand to use the onkeydown function because onkeypress gets handeled differently by different characters.
I don’t know how to handle special chracters like ´ ` ‘ ( ) that might be different in different keyboards around the world.
For keys that have printable character equivalents, you should use the
keypressevent because you can retrieve character codes from thekeypressevent, which is generally not possible forkeyupandkeydownevents.The event properties you need are
whichandkeyCode– pretty much all browsers have one or both of these, though IE muddies the waters by usingkeyCodefor the character code while some other browsers return a (different) key code. Most non-IE browsers also havecharCodebut it seems all such browsers also havewhich, socharCodeis never needed. A simple example:Here is a useful reference page.