Javascript Google将值音译到另一个div中
在示例中,startArea值用于将文本从一种语言转换为另一种语言,并将其自身放置在该语言中 我怎么会把转换后的文本放进finalId元素呢 我在翻译API中搜索过,没有找到任何答案。是否有任何与API相关的支持 这是我使用的脚本Javascript Google将值音译到另一个div中,javascript,Javascript,在示例中,startArea值用于将文本从一种语言转换为另一种语言,并将其自身放置在该语言中 我怎么会把转换后的文本放进finalId元素呢 我在翻译API中搜索过,没有找到任何答案。是否有任何与API相关的支持 这是我使用的脚本 <textarea id="startArea" style="width:600px;height:200px"></textarea> <textarea id="finalId" readonly="readonly" sty
<textarea id="startArea" style="width:600px;height:200px"></textarea>
<textarea id="finalId" readonly="readonly" style="width:600px;height:200px"></textarea>
// Load the Google Transliterate API
google.load("elements", "1", {
packages: "transliteration"
});
function onLoad() {
var options = {
sourceLanguage:
google.elements.transliteration.LanguageCode.ENGLISH,
destinationLanguage:
[google.elements.transliteration.LanguageCode.TELUGU],
shortcutKey: 'alt+t',
transliterationEnabled: true
};
// Create an instance on TransliterationControl with the required
// options.
var control =
new google.elements.transliteration.TransliterationControl(options);
// Enable transliteration in the textbox with id
// 'startArea'.
control.makeTransliteratable(['startArea']);
}
google.setOnLoadCallback(onLoad);
已弃用,我认为在加载页面时会出现Javascript错误,导致逻辑无效
在任何情况下,您都可以按照下面的步骤加载音译库,并在需要时使用函数there调用直接进行音译。结果将是回调函数的参数