标题:检测用户名是否存在的问题
取消只看楼主
liu_libra
Rank: 2
等 级:论坛游民
帖 子:153
专家分:20
注 册:2008-10-13
结帖率:72.22%
 问题点数:0 回复次数:2 
检测用户名是否存在的问题
用户前台
<td width="18%" height="20" align="right" bgcolor="#EEF7FF" class="STYLE4"><span class="STYLE1"> <span class="STYLE6">*</span> </span> 用 户 名:</td>
<td width="34%" align="left" bgcolor="#FFFFFF"><input name="username" type="text" id="username" maxlength="20" />
   <input type="button" name="Submit4" value="检测用户名" onClick="checkName()"></td>

checkName()代码:
<script language="javascript">
function checkName()
{
var NameStr=document.all.userame.value
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST", "UserCheckReg.asp?uName="+NameStr, false);
xmlhttp.send();
if(xmlhttp.ResponseText==1)
alert("用户名已经存在");
else
alert("可以使用!");
}
</script>


UserCheckReg.asp代码:
<script language="javascript">
function checkName()
{
var NameStr=document.all.userame.value
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST", "UserCheckReg.asp?uName="+NameStr, false);
xmlhttp.send();
if(xmlhttp.ResponseText==1)
alert("用户名已经存在");
else
alert("可以使用!");
}
</script>


在网上看到很多类似的代码,可放到我的程序里当点击“检查用户名”的按钮时一点反应也没有,各位帮我看看怎么回事?
搜索更多相关主题的帖子: 用户名 检测 
2008-10-25 14:08
liu_libra
Rank: 2
等 级:论坛游民
帖 子:153
专家分:20
注 册:2008-10-13
得分:0 
刚复制错了,重发一次问题
检测用户名是否存在的问题
用户前台
<td width="18%" height="20" align="right" bgcolor="#EEF7FF" class="STYLE4"><span class="STYLE1"> <span class="STYLE6">*</span> </span> 用 户 名:</td>
<td width="34%" align="left" bgcolor="#FFFFFF"><input name="username" type="text" id="username" maxlength="20" />
   <input type="button" name="Submit4" value="检测用户名" onClick="checkName()"></td>

checkName()代码:
<script language="javascript">
function checkName()
{
var NameStr=document.all.userame.value
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST", "UserCheckReg.asp?uName="+NameStr, false);
xmlhttp.send();
if(xmlhttp.ResponseText==1)
alert("用户名已经存在");
else
alert("可以使用!");
}
</script>


UserCheckReg.asp代码:
<!--#include file="conn.asp"-->
<%
set rs=server.CreateObject("adodb.recordset")
strsql="select * from users where username='"&request("uName")&"'"

rs.open strsql,conn,1,1
if rs.eof and rs.bof  then
response.write 0
else
response.write 1
end if
rs.close
set rs=nothing
%>
在网上看到很多类似的代码,可放到我的程序里当点击“检查用户名”的按钮时一点反应也没有,各位帮我看看怎么回事?
2008-10-25 14:10
liu_libra
Rank: 2
等 级:论坛游民
帖 子:153
专家分:20
注 册:2008-10-13
得分:0 
谢谢楼上版主支持,可怎么还是没反应啊,唉,有个错误提示也好啊!
2008-10-26 01:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-240490-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.170178 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved