I have a textbox that I want to the user to write something in it. I want that the default language there would be english. so if he pressed alt-shift before he came to my page and he is now on other language - when he'll come to my textbox it would change his language to english. Is it possible with javascript? how?
-
1Sure, you can grab keypresses and do redirects in Javascript... but wouldn't it be much more intuitive for the user to just have a little flag link in the corner of the page to change to a different language? That's what most people expect nowadays, I would think.Mark Rushakoff– Mark Rushakoff2009-08-11 11:30:06 +00:00Commented Aug 11, 2009 at 11:30
-
I've got no idea what it means for "the default language to be english". Do you want to show a different webpage in English around your textbox? And what does alt-shift mean?MSalters– MSalters2009-08-11 11:35:24 +00:00Commented Aug 11, 2009 at 11:35
-
1I believe Alt-Shif refers to the standard hotkey of MS Windows' "language bar", which you can use to quickly switch between different keyboard layouts. No idea why you'd want to do this in webpage, though.sleske– sleske2009-08-11 11:38:33 +00:00Commented Aug 11, 2009 at 11:38
-
1-1 The author needs to explain what he wants better.Imagist– Imagist2009-08-11 11:46:10 +00:00Commented Aug 11, 2009 at 11:46
2 Answers
I'm not sure what you mean by "pressing Alt-Shift". Are you referring to the keyboard layout switching hotkey in recent versions of MS Windows?
If yes, then the answer is "no". The layout switching is performed by the operating system and not accessible from Javascript. Which is a good thing, BTW. You would not want a webpage (or even a local application) to switch around your keyboard layout.
Incidentally, I do not understand why you would want to change the layout. If the user is comfortable with, say, a German or French layout, how does it help to change the layout?
Maybe you could elaborate on your problem. What are you trying to solve?
1 Comment
This is not possible, but the thing is possible is check if the char is english. It will forbid chars from Chineese, Russian etc...