求助:注册时检测用户名是否可用?
请高手指教:当点击检测用户名时,为什么没有反应,而在网页的左下角会出现,网页有错误的提示呢?Userreg.html
<FORM name='UserReg' action='UserRegPost.asp' method='post'>
<table width=95% border=0 align="center" cellpadding=5 cellspacing=1 bordercolor="#FFFFFF" style="border-collapse: collapse">
<TR align=center>
<TD height=20 colSpan=2><b>新用户注册</b></TD>
</TR>
<TR>
<TD width="37%"><b>用户名:</b><BR>
不能小于4个字符(2个汉字)</TD>
<TD width="63%"> <INPUT maxLength=14 size=30 name=UserName>
<font color="#FF0000">*</font> <input name="Check" type="button" id="Check" value="检查用户名" onClick="checkreg();"></TD>
</TR>
<TR>
<TD width="37%"><B>密码(至少6位):</B><BR>
请输入密码,区分大小写。 不要使用类似 '*'、' '的特殊字符</TD>
<TD width="63%"> <INPUT type=password maxLength=12 size=30 name=Password>
<font color="#FF0000">*</font> </TD>
</TR>
<TR>
<TD width="37%"><strong>确认密码(至少6位):</strong><BR>
</TD>
<TD width="63%"> <INPUT type=password maxLength=12 size=30 name=PwdConfirm>
<font color="#FF0000">*</font> </TD>
</TR>
<TR>
<TD width="37%"><strong>密码问题:</strong><BR>
忘记密码的提示问题</TD>
<TD width="63%"> <INPUT type=text maxLength=50 size=30 name="Question">
<font color="#FF0000">*</font> </TD>
</TR>
<TR>
<TD width="37%"><strong>问题答案:</strong><BR>
忘记密码的提示问题答案,用于取回密码</TD>
<TD width="63%"> <INPUT type=text maxLength=20 size=30 name="Answer">
<font color="#FF0000">*</font> </TD>
</TR>
<TR>
<TD width="37%"><strong>性别:</strong><BR>
请选择您的性别</TD>
<TD width="63%"> <INPUT type=radio CHECKED value="1" name=sex>
男 <INPUT type=radio value="0" name=sex>
女</TD>
</TR>
<TR>
<TD width="37%"><strong>Email地址:</strong><BR>
请输入有效的邮件地址</TD>
<TD width="63%"> <INPUT maxLength=50 size=30 name=Email>
<font color="#FF0000">*</font></TD>
</TR>
<TR>
<TD><strong>公司网址:</strong></TD>
<TD width="63%"><INPUT name=homepage id="homepage" value="http://" size=30 maxLength=50></TD>
</TR>
<TR>
<TD width="37%"><strong>公司名称:</strong><BR>
您的公司名称</TD>
<TD width="63%"> <INPUT name=CompanyName id="CompanyName" size=30 maxLength=100></TD>
</TR>
<TR>
<TD><strong>收货地址:</strong></TD>
<TD><INPUT name=Add id="Add" size=30 maxLength=100>
<font color="#FF0000">*</font></TD>
</TR>
<TR>
<TD><strong>收货人:</strong></TD>
<TD><INPUT name=Receiver id="Receiver" size=30 maxLength=100></TD>
</TR>
<TR>
<TD><strong>邮政编码:</strong></TD>
<TD width="63%"><input name=postcode id="postcode" size=30 maxlength=20>
<font color="#FF0000">*</font></TD>
</TR>
<TR>
<TD><strong>联系电话:<br>
</strong>格式010-81991660<strong> </strong></TD>
<TD width="63%"><input name=Phone id="Phone" size=30 maxlength=20>
<font color="#FF0000">*</font></TD>
</TR>
<TR>
<TD><strong>手机:</strong></TD>
<TD><input name=Mobile id="Mobile" size=30 maxlength=20></TD>
</TR>
<TR>
<TD width="37%"><strong>传 真:</strong></TD>
<TD width="63%"> <INPUT name=Fax id="Fax" size=30 maxLength=50></TD>
</TR>
</TABLE>
<div align="center">
<INPUT type=submit value=" 注 册 " name=Submit>
<INPUT name=Reset type=reset id="Reset" value=" 清 除 ">
</div>
</form>
<form name='reg' action='../UserCheckreg.asp' method='post' target='CheckReg'>
<input type='hidden' name='username' value=''>
</form><!-Plist_Bottom->
UserCheckRegl.asp
<!--#include file="Inc/conn.asp"-->
<!--#include file="Inc/function.asp"-->
<%
dim UserName,FoundErr,ErrMsg
UserName=trim(request("UserName"))
Response.Write(UserName)
if UserName="" or strLength(UserName)>14 or strLength(UserName)<4 then
founderr=true
errmsg=errmsg & "<br><li>请输入用户名(不能大于14小于4)</li>"
else
if Instr(UserName,"=")>0 or Instr(UserName,"%")>0 or Instr(UserName,chr(32))>0 or Instr(UserName,"?")>0 or Instr(UserName,"&")>0 or Instr(UserName,";")>0 or Instr(UserName,",")>0 or Instr(UserName,"'")>0 or Instr(UserName,",")>0 or Instr(UserName,chr(34))>0 or Instr(UserName,chr(9))>0 or Instr(UserName,"?")>0 or Instr(UserName,"$")>0 then
errmsg=errmsg+"<br><li>用户名中含有非法字符</li>"
founderr=true
end if
end if
if founderr=false then
dim sqlCheckReg,rsCheckReg
sqlCheckReg="select * from [User] where UserName='" & Username & "'"
set rsCheckReg=server.createobject("adodb.recordset")
rsCheckReg.open sqlCheckReg,conn,1,1
if not(rsCheckReg.bof and rsCheckReg.eof) then
founderr=true
errmsg=errmsg & "<br><li>“" & UserName & "”已经存在!请换一个用户名再试试!</li>"
else
end if
rsCheckReg.close
set rsCheckReg=nothing
end if
%>
<html>
<head>
<title>检查用户名</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="mt_style.css" type=text/css rel=stylesheet>
</head>
<body>
<br>
<%
if founderr=false then
call Success()
else
call WriteErrmsg()
end if
%>
</body>
</html>
<%
call CloseConn
sub WriteErrMsg()
response.write "<table align='center' width='300' border='0' cellpadding='2' cellspacing='0' class='border'>"
response.write "<tr class='title'><td align='center' height='15'>错误提示</td></tr>"
response.write "<tr class='tdbg'><td align='left' height='100'>" & errmsg & "<p align='center'>【<a href='javascript:onclick=window.close()'>关 闭</a>】<br></p></td></tr>"
response.write "</table>"
end sub
sub Success()
response.write "<table align='center' width='300' border='0' cellpadding='2' cellspacing='0' class='border'>"
response.write "<tr class='title'><td align='center' height='15'>恭喜你!</td></tr>"
response.write "<tr class='tdbg'><td align='left' height='100'><br>“" & UserName & "”尚未被人使用,赶紧注册吧!<p align='center'>【<a href='javascript:onclick=window.close()'>关 闭</a>】<br></p></td></tr>"
response.write "</table>"
end sub
%>