2016-07-28 81 views
1

我插入了一段代碼,我發現它將谷歌小部件由Google翻譯支持,以便能夠使用更多語言創建網站。雖然標誌確實出現,但看起來光標會將其識別爲鏈接,但在Chrome上進行測試(無需上載)時,單擊標誌並且什麼都不會發生。
我是否需要上傳才能使其工作,或者是代碼中的問題?
很抱歉,如果這是一個愚蠢的問題,我很新的這一切:)谷歌翻譯的html小部件不能正常工作

代碼:

`<script language="JavaScript"> <!-- 
document.write ("<input name=u value="+location.href+" type=hidden>") 
// --> 
</script> 
<input name="hl" value="es" type="hidden"> 
<input name="ie" value="UTF8" type="hidden"> 
<input name="langpair" value="" type="hidden"> 
<input name="langpair" value="es|en" title="English" src="images/UK.gif" onclick="this.form.langpair.value=this.value" height="20" type="image" width="30"> 
<input name="langpair" value="es|pt" title="Portuguese" src= "http://photos1.blogger.com/img/43/1633/320/13539966_0d09b410b5.jpg" onclick="this.form.langpair.value=this.value" height="20" type="image" width="30"> 
<input name="langpair" value="es|fr" title="French" src= "http://photos1.blogger.com/img/43/1633/320/13539949_e76af75976.jpg" onclick="this.form.langpair.value=this.value" height="20" type="image" width="30"> 
<input name="langpair" value="es|de" title="German" src= "http://photos1.blogger.com/img/43/1633/320/13539933_041ca1eda2.jpg" onclick="this.form.langpair.value=this.value" height="20" type="image" width="30"> 
<input name="langpair" value="es|it" title="Italian" src= "http://photos1.blogger.com/img/43/1633/320/13539953_0384ccecf9.jpg" onclick="this.form.langpair.value=this.value" height="20" type="image" width="30"> 
<input name="langpair2" value="es|ar" title="Arabic" src= "http://photos1.blogger.com/blogger/3709/485/1600/arabic-flag.gif" onclick="this.form.langpair.value=this.value" height="20" type="image" width="30" /> 
</form>` 

回答

0

你錯過了開放的形式標記,第一件事,<script ...前:

<form action="http://www.google.com/translate" > 

我測試了一個本地文件並按下標誌將您發送到translate.google.com

但是,Google必須有權訪問您的HTML頁面才能對其進行翻譯,因此此小部件僅在互聯網上的公共網站上有效。它似乎並不適用於本地或Intranet站點。