+ -
当前位置:首页 → 问答吧 → 崩溃啊,各位大神帮我找找错误的地方

崩溃啊,各位大神帮我找找错误的地方

时间:2011-05-08

来源:互联网

崩溃啊,这个是对着教程上写的,可结果还是错啊
function postword() { 
var xmlhttp=new XMLHttpRequest();
  xmlhttp.open=("GET","imhello.php?word=hello",ture);
  xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
  {
  docunment.getElementById("wordone").innerHTML=xmlhttp.responseText;
  }
  }
  xmlhttp.send();
}  
</script>

作者: dream1206   发布时间: 2011-05-08

IE显示说网页错误,chrome也没反应,我可以确定这个方法调用正确,也有imhello.php这个页面

作者: dream1206   发布时间: 2011-05-08

xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
去掉。get方法无需这个

作者: net_lover   发布时间: 2011-05-08

var xmlhttp=new XMLHttpRequest();

应该写成
var xmlhttp=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");

作者: net_lover   发布时间: 2011-05-08

还是网页有错误,我晕。。。。。
折腾我的眼睛了

作者: dream1206   发布时间: 2011-05-08

xmlhttp.onreadystatechange 很明显是这个错误了 改大些的字母没大写 以后别再粗心了 基本的编码习惯都没有

作者: qq413041153   发布时间: 2011-05-08

热门下载

更多