日期:2014-05-16 浏览次数:20629 次
function createXmlHttpRequest(){
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlHttpRequest=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlHttpRequest=new ActiveXObject("Microsoft.XMLHTTP");
}
alert("1="+xmlHttpRequest);
}
function oneByone(){
xmlHttpRequest=createXmlHttpRequest(); //创建xmlHttpRequest对象
xmlHttpRequest.onreadystatechange=getQuestion();
var url="test!showWrongQuestion?wrongQuestionNo=1";
xmlHttpRequest.open("GET",url,true); //初始化组件
xmlHttpRequest.send();
}
function getQuestion(){ //回调函数
alert("2="+xmlHttpRequest);
if (xmlHttpRequest.readyState==4 && xmlHttpRequest.status==200){
alert("3="+xmlHttpRequest);
var wrongQuestion=xmlHttpRequest.responseText;
// setTimeout("oneByone(url)", 5000);
}
}