<script>
var url="http://192.168.18.18/1.asp";
var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("post",url,true);
xmlhttp.onreadystatechange=function(){change(xmlhttp)}
xmlhttp.send();function change(obj)
{
  alert(obj.readyState);
}
</script>

解决方案 »

  1.   

    <script>
    var oDiv 
    var xh  
    function getXML()
    {
     oDiv = document.all.m
     oDiv.innerHTML = "正在装载栏目数据,请稍侯......."
     oDiv.style.display= ""
     xh = new ActiveXObject("Microsoft.XMLHTTP")
     xh.onreadystatechange = getReady
     xh.open("GET",a.value,true)
     xh.send()}function getReady()
    {
     if(xh.readyState==4)
     {
      if(xh.status==200)
      {   oDiv.innerHTML = "完成"
      }
      else
      {
       oDiv.innerHTML = "抱歉,装载数据失败。原因:" + xh.statusText
      }
     }
    }
    </script>
    xmlhttp异步的例子:
    URL:<input name=a value="http://www.sohu.com" style="width:600px">
    <input onclick="getXML()" type="button" value="得到源代码">
    <input onclick="if(xh && xh.responseText) {alert(xh.responseText);oDiv.innerHTML=xh.responseText}" type="button" value="显示源代码">
    <div id=m></div>