ajax--为什么用ajax验证相同的用户名时只进行一次?

来源:百度知道 编辑:UC知道 时间:2024/06/14 16:27:27
function check_username(username)
{
var xmlHttp=null;
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(oc)
{
xmlHttp=null;
}
}
if(!xmlHttp && typeof xmlHttpRequest !="undefined")
{
xmlHttp=new XmlHttpRequest();
}
var username = document.getElementById("Text1").value;
if ((username == null) || (username == ""))
return;
var url = "index.aspx?regname="+escape(username);
xmlHttp.open("GET", url, true);
xmlHttp.setRequestHeader('Content-type','application/x-www-form-urlencoded');
xmlHttp.send(null);
xmlHttp.onreadystatechan

面页缓存问题
var url = "index.aspx?regname="+escape(username)+r=“这个值或者是随机数或者是日期”;

这样就可以解决你的问题了

这段代码没有问题的。我想你可以从别的代码中查找问题。。