function createXMLHttpRequest() { if (window.ActiveXObject) { var xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { var xmlHttpObj = new XMLHttpRequest(); } return xmlHttpObj;}
實(shí)例化時(shí)相應(yīng)的改為:
function test1(){ xmlHttp_1 = createXMLHttpRequest(); xmlHttp_1.onreadystatechange = handleStateChange1; url_1 = "test.php?ts=" + new Date().getTime(); xmlHttp_1.open("GET", url, true); xmlHttp_1.send(null);}
function test2(){ xmlHttp_2 = createXMLHttpRequest(); xmlHttp_2.onreadystatechange = handleStateChange1; url_2 = "test.php?ts=" + new Date().getTime(); xmlHttp_2.open("GET", url, true); xmlHttp_2.send(null);}