<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;
??}
?}
}
function showCode(p)
{
?if(xh && xh.responseText)
?{
??if(p>0)
???oDiv.innerHTML=xh.responseText;
??else
??{
???oDiv.innerHTML="";
???coder.value=xh.responseText;
??}
?}
}
</script>
xmlhttp异步的例子
URL: name=a value=" http://cn.php.net" size="40">