在发送request的时候,一般情况下xmlHttp.onreadystatechange = handleStateChange;是不允许直接带参数的,但是如何我们想要带参数怎么办?
可以这样解决:xmlHttp.onreadystatechange = function(){handleStateChange(a,b);}
下面就是需要你自定义handleStateChange(a,b)这个函数了,这个我想总归会的,不会的去搜索一下,网上多的是。。。顺便抄一个吧

function handleStateChange(a) {
    //alert(xmlHttp.readyState);
    if(xmlHttp.readyState == 1) {
        document.getElementById(a).style.cssText = "";
        document.getElementById(a).innerHTML = "<div align="center"><img src="images/loading.gif" /></div>";
    }
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
            document.getElementById(a).style.cssText = "";
            var ReturnStr =  xmlHttp.responseText;
            document.getElementById(a).innerHTML = "<span style="color:green">" + ReturnStr + "</span>";
        }
    }
}