日期:2014-05-16 浏览次数:20584 次
function asdf(){ var i; i=1; for(i=1;i<=100;i++){ show("jq1.asp?text="+i); } }
function createAjax(){ var http; if (window.ActiveXObject){ http=new ActiveXObject("Microsoft.XMLHTTP") ? new ActiveXObject("Microsoft.XMLHTTP") : new ActiveXObject("Msxml2.XMLHTTP"); } else if(window.XMLHttpRequest) { http=new XMLHttpRequest(); } return http; } var ajax=createAjax(); function show(vv){//ajax乱码是因为在传递中文的时候没有进行编码,escape()是进行编码。 ajax.open("GET",vv+"&num="+Math.random(),true); ajax.send(null); ajax.onreadystatechange=getmessage; } function getmessage(){ var html; if (ajax.readyState==4){ if (ajax.status==200){ html=ajax.responseText; document.getElementById("yz").innerHTML=document.getElementById("yz").innerHTML+"<Br>"+html; }else alert('status is:'+ajax.status); }else{ //document.getElementById("yz").innerHTML=document.getElementById("yz").innerHTML+"<BR>"+ajax.readyState; } //alert(html); }