日期:2014-05-16 浏览次数:20780 次
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>测试-验证用户名是否重复</title>
<script type="text/javascript">
function yanzheng_zhuce(){
var tmpusername=document.zhuce.username.value
if(tmpusername=="")
{
alert("不能为空")
return false
}
else
var url="check.asp?username=" + escape(tmpusername)+"&sid="+Math.random();
xmlHttp.onreadystatechange = processSet;
xmlHttp.open("GET", url, true);
xmlHttp.send();
}
function processSet(){
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
……
……
……
alert("用户名重复");
}
}
}
}
</script>
</head>
<body>
<form name="zhuce" action="" method="post" onsubmit="return yanzheng_zhuce()">
<input type="text" name="username" /><input type="submit" value="提交" />
</form>
</body>
</html>