![]() |
|
#1
|
|||
|
|||
Javascript in HTMLhi ,
I have this fantastic idea of creating a web page that does transliteration like google except spelling suggestion. My idea is to take input from user in text box & process on receiving a space. For this purpose I think , I will need ajavascript which will dynamically transliterate. Can you tell me is there is any function which can pass string just input for processing ? Suppose user has already written 'ALREADY' Now he appends " new " after last white space key press the string 'new' should be retrieved . Another java function will process 'new' to create hindi word . The advantage is you have transliteration using a webpage . Please suggest ? I know bit of html & java. |
|||
|
#2
|
||||
|
||||
Re: Javascript in HTMLDo you mean something like this?
In this example, any misspelled 'gren' [green] or 'yelow' [yellow] is converted/translated to the correct spelling. This is checked as any space is entered within the text field. HTML Code:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#3
|
|||
|
|||
Re: Javascript in HTMLThank you TurboPT for your valuable reply.
I am looking for something similiar. I understood that on every keypress check key is called then if it is a space then you retrieve the whole text typed into text box & replace gren by green & yelow by yellow. Is it possible to retrieve only the last word. Example if text box has : teraa naam kyaa hai then like google transliterate we will already have तेरा नाम क्या so as user presses space after hai . I want to process "hai" which my transliterate function will convert to है . |
|
#4
|
||||
|
||||
Re: Javascript in HTMLThe problem is, how/when do you know that their input IS the last word followed by a space?
[as more typing could possibly follow] My help might be limited, but figured that could be a start. I guess you could check for that word with the trailing space included, but that would be need to be determined based on your need[s]. I don't know your language, but I'm sure that word could appear more than once in any potential input? __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#5
|
|||
|
|||
Re: Javascript in HTMLas soon as user presses space we will grab the last letter of text area & keep going backwards till we encounter another space . So whatever we have read is the last word spelled backwards . Isn't it ?
|
|
#6
|
||||
|
||||
Re: Javascript in HTML...but you said [in post #1] "process on receiving a space", so that sounds different now, and you have added 'textarea', instead of 'textbox'...?
So, how do you expect the operation to actually behave? The difference almost sounds like after a submit, or some other operation. __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#7
|
|||
|
|||
Re: Javascript in HTMLif you are not able to see hindi font then please see
www.ffonts.net OR www.devanagarifonts.net sorry , i thought textarea & textbox mean same. i don't want user to press any button for transliteration. QUESTION)Are there any functions in javascript which can retrieve word from string ? in your original code , i think you get the whole 'whatever user typed'. Let us say , if there is no way to get last word . Then my next option is to transliterate whatever user has typed so far . There will be another window which shows hindi text in case we are not able to get last word typed in text box. The function below will be used when I want to add unicode characters to that transliteration window Code:
Rules will be Code:
Now the process will be as follows Code:
|
|
#8
|
||||
|
||||
Re: Javascript in HTMLQuote:
Quote:
Quote:
In my original code, yes, I do get "whatever user typed", because the user can "click back" to a previous [or any other] point in the line and make a change, so whenever this happens, ANY changes will be checked. The "Last Word" - I'm not sure what would "trigger" that the user is done with input to know the need to check the "last word"...what is your basis? Quote:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#9
|
|||
|
|||
Re: Javascript in HTMLIn your example , it is suitable & better to fix spelling of 'green' & 'yellow' in whole textbox/textarea(consider both words as interchangeable).
Whereas in mine , My ideal method will be to use just one window & get the word as soon as user presses space & replace it by hindi equivalent. This way at any time , all words will be in hindi except the one which is being spelled in english & has not been terminated with space. In case , user modifies previously typed words (which are now in hindi) : I will see later what happens in that case . Let us say , my ideal presumption seems difficult to implement now. Then I am fine with two windows . The one in which user types & as soon as he presses space 'whole text' is converted to hindi & transliteration window gets fully rewritten. As you must have seen , I have mentioned abstract algorithm in my previous post. I know a bit of C in which there are functions to get character by character from stream. QUE)Is there any such function in java ? QUE)Also any if/else equivalent to decide what takes precedence ? I will try to use string manipulation function & regexp and report here on my progress & further queries. QUE)For trial purpose how can I echo variable values to debug window to see how my function is behaving ? Thank You. |
|
#10
|
|||
|
|||
Re: Javascript in HTMLIgnore my previous post .
I have implemented your example according to my needs Actually I am replacing combination of letters with suitable hindi word So far , here is the code HTML Code:
Example if I write vu expecting वु I notice that it stops at वu because v has been replaced with व while ु will come only when it gets 'v' before 'u' which is not present. Then I changed 's' to 'सs' so that letter 's' till appears after replacement yet su brings up 'सs ' I was expecting su -> सsu -> सु Interestingly , sau brings सु I don't understand why ? Last edited by admin : 15-Jul-2012 at 09:15.
Reason: Please insert your example HTML codes between [HTML] and [/HTML] tags
|
Recent GIDBlog
Compress Your Web Site by gidnetwork
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| We're looking for JavaScript codes / mini tutorials. | JdS | Web Design Forum | 10 | 21-Nov-2011 09:47 |
| An Introduction to Javascript | JasonMichael | Web Design Forum | 2 | 24-Oct-2004 10:19 |
| JavaScript Tutorial Part 1 | pcxgamer | Web Design Forum | 2 | 01-Dec-2003 09:16 |
| Javascript: Pop Up Tutorial | BobbyDouglas | Web Design Forum | 0 | 20-Nov-2003 22:19 |
| PHP in HTML | jrobbio | Web Design Forum | 4 | 24-Jul-2003 06:05 |
Network Sites: GIDNetwork · GIDApp · GIDSearch · Learning Journal by J de Silva, The