![]() |
| |||||||
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
| |||
againAnother one that I've been searching for a while.. how can i change a textbox input language from english to greek? What I mean... In my keyboard I have 2 languages, english and greek. I want, when I type to a textbox, to write in greek, even if the language selected is english. Thank you ![]() |
| Sponsored Links |
| ||||
| The only thing I can think of is to use the JavaScript replace during the onkeyup event and replace the corresponding character with the appropriate Greek character. You could create an array and then read from that array.
__________________ jmurrayhead Did I help you out? Make me popular by clicking the icon!If you found a post helpful, please click the button in the lower right-hand corner of the post.Powered by ASP.Net |
| |||
| Quote:
I mean, while typing the english characters to be replaced by the greek ones.. |
| ||||
| I think the onKeyUp event will work best for this. See here: JavaScript onkeyup Event You could have an array that holds English characters and Greek characters. Then in the onKeyUp event, find the index of the corresponding English character and use that to find the corresponding Greek character. Then use the JavaScript replace function to replace it: Javascript Tutorial - Replace Hope this helps ![]() |
| |||
| Why this doesn't work? ![]() Code: <% function ChkStr(strT) strT = Replace(strT, "a", "α") strT = Replace(strT, "b", "β") ChkStr = strT End Function %> <input type="text" id="test" onKeyUp="ChkStr(this.id)"> |
| |||
| Found it! ![]() Code: function greeklish(x)
{
var y=document.getElementById(x).value;
y=y.replace("a", "α");
y=y.replace("b", "β");
y=y.replace("g", "γ");
document.getElementById(x).value=y
}
<input type="text"
id="greek" onKeyUp="greeklish(this.id)">
|
| |||
| Quote:
![]() For the english characters that don't exist in greek I did this: Code: if (y.match("c"))
{
alert("Μόνο ελληνικά");
y=y.replace("c", "");
}
The problem though is that with your code starts ok (a=α, b=β, ...) but then it replaces your "m" with our "n", your "k" with our "l" and other... it's not correct.. |
| ||||
| Yeah...I thought that might be a problem... What you need to do is, if c isn't a letter in greek, any letters after c have to only have 847 added to them. Then if, for example if j isn't a letter in greek, anything after j would only have 846 added to it. Depending on how many letters don't have a replacement, perhaps a switch statement might be better. Hope that makes sense... ![]() |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| textbox validation | todd2006 | JavaScript Programming | 6 | July 2nd, 2008 01:30 PM |
| find words and change | todd2006 | JavaScript Programming | 4 | July 2nd, 2008 09:58 AM |
| Change to Reputation System | jmurrayhead | Announcements | 0 | June 2nd, 2008 09:57 PM |
| Textbox or List help | Rebelle | JavaScript Programming | 9 | April 21st, 2008 10:00 AM |
| Sponsored Links |
| ASP.NET Resource Index a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer. Free Web Directory Including Chats and Forums Resources, Offer automatic, instant and free directory submissions. | URLZ Web Directory URLZ Web Directory Free Web Directory - Add Your Link The Little Web Directory | Free Web Directory Pegasus free web directory is a free directory organised by categories. Web Directory & SEO Services dirroot web directory |