Hi Guys,
I got a weird case, when I first load the api I got the translated
french TEXTAREA: bonjour, after I changed the TEXTAREA value to hello
world and press the button, it
still returns bonjour no matter what I chaged the value to, could
anyone help me with that?
here is my code:
html code:
<TEXTAREA class=tap_text id=text name=text>hello</TEXTAREA><BUTTON
class=tap_btn onClick="trans();" id=trans_btn name=trans_btn
value="Translate">Translate</BUTTON>
js code:
google.load("language", "1");
function initialize() {
trans();
}
google.setOnLoadCallback(initialize);
function trans() {
var text = document.getElementById("text").value;
google.language.translate(text, 'en', 'fr',
function(result) {
var translated = document.getElementById("text");
if (result.translation) {
translated.value = result.translation;
}
}
);
return false;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google AJAX APIs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-AJAX-Search-API?hl=en
-~----------~----~----~----~------~----~------~--~---