ajax代码
var xmlobj;
var strclassname;
function CreateXMLHttpRequest()
{
if(window.XMLHttpRequest)
{//Mozilla浏览器
xmlobj=new XMLHttpRequest();
if(xmlobj.overrideMimeType)
{//设置MIME类别
xmlobj.overrideMimeType("text/xml");
}
}
else if(window.ActiveXObject)
{//IE浏览器
try
{
xmlobj=new ActiveXObject("Msxml2.XMLHttp");
}
catch(e)
{
try
{
xmlobj=new ActiveXobject("Microsoft.XMLHttp");
}
catch(e)
{
}
}
}
}
function ValidatePro(tj,uid,page,downkey) //主程序函数
{
CreateXMLHttpRequest(); //创建对象
if(downkey==1){
if (event.keyCode==13)
{
event.keyCode=0;
event.returnValue = false;
var showurl = "chuli_dd_pro.php?tj="+tj+"&uid="+uid+"&page="+page; //构造URL
xmlobj.open("GET", showurl, true); //调用validate.php
xmlobj.onreadystatechange = StatHandlerPro; //判断URL调用的状态值并处理
xmlobj.send(null); //设置为不发送给服务器任何数据
}
}
}
function StatHandlerPro() //用于处理状态的函数
{
if(xmlobj.readyState == 4 && xmlobj.status == 200) //如果URL成功访问,则输出网页
{
//alert(xmlobj.responseText);
str=xmlobj.responseText;
strarray=str.split("@");
document.getElementById("showpro").innerHTML=strarray[1];
document.getElementById("fy").innerHTML=strarray[0];
}
}