Forum Moderators: open

Message Too Old, No Replies

Problem Finding Page Data Var

         

Jon_King

12:07 am on Mar 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can someone show me how to grab the translated text from a call to the G translator and put it into a javascript var?

A typical example below:

[translate.google.com...]

In the above url example I'm wishing to translate 'agua' to 'water' then return the result 'water' in a js var and not display the G result page. Your help is greatly appreciated.

RonPK

11:03 am on Mar 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The translation is put into a DIV with the ID 'result_box':

<div id=result_box dir=ltr>water </div>

If your script would run on that page, you could simply read

document.getElementById('result_box').innerHTML
. Problem is that your script does not run on that page, so it cannot access any property.

So you'll need a server side script that fetches the Google translated page and that parses the translated text. Might be against Google's TOS...

Jon_King

12:48 pm on Mar 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I realize the parsing server side problem now. Thanks RonPK.