changing keyCode onkeydown

S

ShayHk

hi
I want to know if there is a way to change the keycode on press

the main goal
is to switch any languagh to english
for example
when I press on "×" (hebrew) the output will return as "t"..

thanks
 
G

GArlington

hi
I want to know if there is a way to change the keycode on press

the main goal
is to switch any languagh to english
for example
when I press on "×" (hebrew) the output will return as "t"..

thanks

You need javascript onkeydown...
 
T

Thomas 'PointedEars' Lahn

ShayHk said:
I want to know if there is a way to change the keycode on press

That's only possible in MSHTML-based UAs.

http://msdn2.microsoft.com/en-us/library/ms533927(VS.85).aspx
the main goal
is to switch any languagh to english
for example
when I press on "×" (hebrew) the output will return as "t"..

var o = document.forms[0].elements[0];
o.onkeydown = function(e) {
if (e.keyCode == "V".charCodeAt(0)
&& !e.ctrlKey && !e.altKey && !e.metaKey)
{
this.value += e.shiftKey ? "X" : "x";
return false;
}

return true;
};

Works in Firefox 2 (only with enabled script support, of course).
Good luck for adapting this to your requirements.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top