日期:2014-05-16 浏览次数:20655 次
var ajax;
function showHint()
{ var username = document.getElementById(Lusername).value;
ajax=GetXmlHttpObject();
if (ajax === null)
{
alert ("Browser does not support HTTP Request");
return;
}
var url="./script/php/determine.php?sendUsername="+username;
ajax.onreadystatechange=stateChanged ;
ajax.open("GET",url,true);
ajax.send(null);
}
function stateChanged()
{
if (ajax.readyState === 4 && ajax.readyState === 200)
{alert(ajax.responseText);}
}
function GetXmlHttpObject()
{
var ajax=null;
try{ajax=new XMLHttpRequest();}
catch (e)
{ try{ajax=new ActiveXObject("Msxml2.XMLHTTP");}
catch (e){ajax=new ActiveXObject("Microsoft.XMLHTTP");}
}
return ajax;
}
function stateChanged()
{
if (ajax.readyState === 4){
alert(ajax.responseText);
}
}
//var url="./script/php/determine.php?sendUsername="+username;
//==>url改成绝对路径,./这种比较少见。。
var url="/script/php/determine.php?sendUsername="+username+'&_dc='+new Date().getTime();//加个时间戳防止ie下get缓存