我正在開發一個項目,我需要根據使用AJAX單擊的標誌更改語言。它在IE7中工作正常,但在IE6中運行時顯示錯誤。IE6和IE7之間的瀏覽器兼容性
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script language="javascript">
google.load("language", "1");
function fnTrans(strTransText,strTransField, strTransFLang, strTransTLang)
{
google.language.translate(strTransText, strTransFLang, strTransTLang, function(result) {
var strcontainer = document.getElementById(strTransField);
strcontainer.innerHTML = result.translation ;
});
}
function initialize(strToTxtBox, strFromTxtBox) {
var x = window.location.toString();
var strLang = x.substring(x.indexOf("=")+1);
if((x.indexOf("="))==-1) return;
strFLang = strLang.substring(0,2)
strTLang = strLang.substring(strLang.indexOf("-")+1);
var strText = document.getElementById(strFromTxtBox).innerHTML;
if(strFLang != 'en')
fnTrans(strText,strFromTxtBox, 'en',strFLang)
fnTrans(strText,strToTxtBox, strFLang,strTLang)
}
function fnhi()
{
var label=document.getElementsByTagName("label");
var count=label.length;
var x = window.location.toString();
var strLang = x.substring(x.indexOf("=")+1);
if((x.indexOf("="))==-1)
return;
for(var i=0;i<count;i++)
{
initialize(label[i].id,label[i].id);
}
document.getElementById("curlang").value=strTLang;
}
function fnClick(lang)
{
if(lang=="") return;
var curlang=document.getElementById("curlang").value;
if(lang==curlang) return;
window.location='language.php?strLang=' + curlang+'-'+lang;
}
</script>
</head>
<body onload="fnhi()">
<input type="hidden" id="curlang" value="en" size="3">
<img src= "langauage.gif" use ="#map">
<map name="Map">
<area shape="rect" alt="Arabic" value="ar" coords="36,6,62,19" href="#" onclick="fnClick(this.value);">
<area shape="rect" alt="Chinese" value="zh" coords="66,6,90,20" href="#" onclick="fnClick(this.value);">
<area shape="rect" alt="German" value="de" coords="95,6,121,21" href="#" onclick="fnClick(this.value);">
</map>
</body>
</html>
「它顯示錯誤,當我在IE6中運行」。在IE6中看到什麼錯誤? – 2009-04-27 11:26:59