<script language="javascript">
var XMLHttpReq = false;
//XMLHttpRequest
function createXMLHttpRequest()
{
if(window.XMLHttpRequest)
{
//Mozilla
XMLHttpReq = new XMLHttpRequet();
}
else if(window.ActionXObject)
{
//IE
try{
XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try{
XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e){}
}
}
}
//
function sendRequest(url)
{
createXMLHttpRequest();
XMLHttpReq.open("GET", url, true);
XMLHttpReq.onreadystatechange = processResponse; //??
XMLHttpReq.send(null); //
}
//处理返回信息函数
function processResponse()
{
if(XMLHttpReq.readyState ==4)
{//判断对象状态
if(XMLHttpReq.status ==200)
{//信息已经成功返回,开始处理信息
var res = XMLHttpReq.responseXML.getElementsByTagName("res")[0].firstChild.data;
window.alert(res);
}
else
{//页面不正常
window.alert("您所请求的页面有异常.");
}
}
}