效果如下: TRANSLATE
<div id="google_translate_element"  style="display:none;"></div>
<div id="translate_link" style="margin-bottom:14px"/>
<a href="#"
onclick="document.getElementById('google_translate_element').style.display='inline';document.getElementById('translate_link').style.display='none';return false;">
TRANSLATE
</a>
<script type="text/javascript">
    function googleTranslateElementInit() {
        new google.translate.TranslateElement({
            pageLanguage: 'en',
            autoDisplay: false,
            gaTrack: true,
            layout: google.translate.TranslateElement.InlineLayout.SIMPLE
        }, 'google_translate_element');
    }
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit" type="text/javascript"></script>

以上代码嵌入到页面body中,即可实现调用google翻译,翻译页面body内容。

注:只改变页面显示效果。

 

posted on 2012-04-14 13:38  牟珏玘  阅读(1617)  评论(2编辑  收藏  举报