<script>
$("body").attr("id",'google_translate_element');
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'es',//默认语言
includedLanguages: 'zh-CN,en,hr,cs,da,nl,fr,de,el,iw,hu,ga,it,ja,ko,pt,ro,ru,sr,es,th,vi', // 可选语言
autoDisplay: false,
gaTrack: false,
gaId: 'UA-4334041-9',
layout: google.translate.TranslateElement.InlineLayout.SIMPLE
}, 'google_translate_element');
}
</script>
<style>
.skiptranslate{
position: absolute;
top: 0;
z-index: 999;
/*display: none !important;*/
}
.skiptranslate .skiptranslate{
display: none;
}
.goog-te-banner-frame.skiptranslate {
display: none !important;
}
body {
top: 0px !important;
}
</style>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<!-- 给body 标签添加一个ID 就行了 id='google_translate_element'-->
<!-- 、、 打开页面 自动翻译 在PHP里面添加 k-->
打开页面就是英语
<?php
$googtrans = '/en/en';
setcookie("googtrans",$googtrans, time()+3600*24);
?>
打开页面就是西班牙语
<?php
$googtrans = '/es/es';
setcookie("googtrans",$googtrans, time()+3600*24);
?>