当前位置: 代码迷 >> JavaScript >> xmlhttp.onreadystatechange=ontext; ontext()这个函数为什么不被触发运行?怎是咋回事
  详细解决方案

xmlhttp.onreadystatechange=ontext; ontext()这个函数为什么不被触发运行?怎是咋回事

热度:241   发布时间:2012-09-23 10:28:11.0
xmlhttp.onreadystatechange=ontext; ontext()这个函数为什么不被触发运行?怎是怎么回事?
function loadXMLDoc()
{………………此处省略N个代码
xmlhttp.onreadystatechange=ontext;
………………此处省略N个代码
}

function ontext()/////////////这个函数为什么不被触发运行?怎是怎么回事?
{
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
  {
  document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
  }
}

------解决方案--------------------
出错了。。status!=200
  相关解决方案