这句js如何弄兼容ff浏览器???
<SCRIPT language="JavaScript">
function GetResult(xh,stuname,team)
{
var xh = document.getElementById("xh").value;
var stuname = document.getElementById("stuname").value;
var team = document.getElementById("team").value;
var oBao = new ActiveXObject("Microsoft.XMLHTTP");
oBao.open("POST","search.asp?xh="+escape(xh)+"&stuname="+escape(stuname)+"&team="+escape(team),false);
oBao.send();
var backstring=unescape(oBao.responseText);
document.all.msg.innerHTML =backstring;
}
//-->
</script>
在ie下可以,但是在ff就执行了无效。。。求解决~~
------解决方案--------------------你的那个是只支持ie
var oBao=null;
if (window.XMLHttpRequest)
{// code for all new browsers
oBao=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE
oBao=new ActiveXObject("Microsoft.XMLHTTP");
}
替换你的 var oBao = new ActiveXObject("Microsoft.XMLHTTP");就可以