方法一:
function gethttp(sid, url){
var xmlHttp;
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
xmlHttp.onreadystatechange = function(){
if(xmlHttp.readyState == 4){
document.getElementById(sid).innerHTML = xmlHttp.responseText;
}
}
xmlHttp.open("POST",url,true);
xmlHttp.send(null);
}
方法二:
function gethttp(sid, url){
if (window.XMLHttpRequest) {
var req = new XMLHttpRequest();
if (req.overrideMimeType) {
req.overrideMimeType(''text/html'');
}
req.onreadystatechange = function(){
if (req.readyState == 4) {
if (req.status == 200) {
alert(id+" "+req.responseText);
document.getElementById(sid).innerHTML = req.responseText;
}
else {
alert("Problem with server response: "+ req.statusText);
}
}
}
try {
req.open("POST", url, true);
}
catch (e) {
alert("Server Communication Problem "+e);
}
req.setRequestHeader("Cache-Control","no-cache");
req.setRequestHeader("If-Modified-Since",new Date(0));
req.setRequestHeader("Content-length", url.length);
req.setRequestHeader("Connection", "close");
req.send(null);
}
else
if (window.ActiveXObject) {
try{
var req = new ActiveXObject("Msxml2.XMLHTTP");
req.setRequestHeader("Content-Type",</