栏目导航
热点推荐
- ASP下批量删除数据的两种方法
- 关于二级域名共享cookies
- ASP错误代码大全
- ASP代码实现show.asp?id=26变成s
- ASP错误信息解决:IIS启用父路径
- 一些常用的正则表达式大全
- ASP超级链接和HTML函数正则表达
- ASP隐藏下载地址及防盗代码
- 最常用的正则表达式示例
- ASP程序数据库被挂马的处理方法
- ASP生成html的新方法
- 精通ASP错误提示大全
阅览排行
asp+ajax检测用户名是否在存
www.jz123.cn 2009-01-13 来源: 中国建站 编辑整理 我要投递新闻
上面写了一篇asp检测用户是否存在的教程,现在我们利用它再与ajax来实例用户名是否存在的教程吧。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> asp+ajax检测用户名是否在存</title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
function checkUserName(userName){
//建立跨浏览器的XMLHttpRequest对象
var xmlhttp;
try{
xmlhttp= new ActiveXObject('Msxml2.XMLHTTP');
}catch(e){
try{
xmlhttp= new ActiveXObject('Microsoft.XMLHTTP');
}catch(e){
try{
xmlhttp= new XMLHttpRequest();
}catch(e){}
}
}
//创建请求,并使用escape对userName编码,以避免乱码
xmlhttp.open("get","checkUserName.asp?userName="+escape(userName));
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4){
if(xmlhttp.status==200){
//根据responseText判断用户名是否存在
if(xmlhttp.responseText=="1")alert("对不起,该用户名以存在!");
else alert("恭喜!该用户名未被注册!");
}else{
alert("网络失败。");
}
}
}
xmlhttp.send(null);
}
//-->
</script>
</body>
</html>
上一篇:Web文件的ContentType类型大全 下一篇:ASP检测用户名是否存在