大家好,本文将围绕用js实现网页翻译展开说明,js网页翻译插件是一个很多人都想弄明白的事情,想搞清楚javascript翻译器需要先了解以下几个事情。
浏览器网页谷歌翻译-使用js脚本
使用浏览器书签对网页进行谷歌翻译
java: void((function () {
var = document.createElement('');
.src = '//translate.google.cn/translate_a/element.js?cb=googleTranslateElementInit';
document.getElementsByTagName('head')[0].appendChild();
var google_translate_element = document.createElement('div');
google_translate_element.id = 'google_translate_element';
google_translate_element.style = 'position:fixed; bottom:10px; right:10px; cursor:pointer;';
document.documentElement.appendChild(google_translate_element);
= document.createElement('');
.innerHTML = "function googleTranslateElementInit() {" +
"new google.translate.TranslateElement({" +
"layout: google.translate.TranslateElement.InlineLayout.SIMPLE," +
"multilanguagePage: true," +
"pageLanguage: 'auto'," +
"includedLanguages: 'zh-CN,zh-TW,en'" +
"}, 'google_translate_element');}";
document.getElementsByTagName('head')[0].appendChild();
})());