我解决了分配onload事件而不是onreadystatechange的问题:
function Request(url, callback){ if (window.XMLHttpRequest) { // Mozilla, Safari, ... httpRequest = new XMLHttpRequest(); } else if (window.ActiveXObject) { // IE httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } else{ return false; } var readyStateChange = function(){ console.log(httpRequest.readyState); if (httpRequest.readyState == 4) { callback(httpRequest.responseText); } }; if (isFirefox && firefoxVersion > 3) { httpRequest.onload = readyStateChange; } else { httpRequest.onreadystatechange = readyStateChange; } console.log(httpRequest, url); httpRequest.open('GET', url, true); httpRequest.send(null); }