问题
Primarily need to understand how to manipulate the displayed translated text, using javascript, in order to convert it to usable text.
I'm creating a 3 box translation system: source text-->translated text-->source language
This will allow English to be entered. The French translation (next to it). The French translated back into English (next to it).
This would be the ultimate google translator as the writer could check his French translation by reading it in English (as he types it!!); avoiding stupid translation errors.
BTW this works well as a concept, but is extremely laborious, involving copy and paste across 2 tabs for every change made (ie. not as it is typed).
This could be done any way, to get the end result.
I'm currently developing it with 3 iframes, using the function below (onclick), to store the source text.
var pg_1 = document.getElementById("textarea_id").value;
localStorage.pg_1_text=pg_1;
And this script to write it into page 2, where it will be auto-translated.
document.getElementById("result").innerHTML="<pre>" + localStorage.pg_1_text + "</pre>";
I now need to get the translated displayed text written into page 3.
Evidently I can drag the mouse across the text, copy and paste into page 3. However, an onclick system would be better. Write a paragraph, click on each page, view the results..... that'd be fine.
My problem is that I don't know how this 'displayed text' is referenced. But however it is, the priority is to get the displayed text into page 3.
(Note: I have had a read of similar threads and none seem to be applicable)
来源:https://stackoverflow.com/questions/13181794/grab-copy-convert-to-variable-google-translated-text-write-to-other-page-clie