注册 登录
编程论坛 WEB前端(UI)

用ASP写注册页面直接提示功能的代码

kidy2005 发布于 2007-05-14 14:07, 3091 次点击

就像http://register.9you.com/regist1.jsp中,当我打开该注册页面的时候用户名输入框后提示:用户名可使用数字、字母,长度为6-12,当我输入汉字的时候直接提示:用户名只可使用数字、字母

而当我输入数字或字母位数少于6位或者位数大于12位的石油直接提示:用户名长度只能为6-12位

以及正则表达式在Javascript脚本中如何应用:

我想将注册页面的用户名限制为6-12的数字或字母,在Javascript脚本中中如何应用\w{6,12}???

有谁可以将代码帖出来让大家分享下!!!

希望能够得到帮助!

7 回复
#2
kobe4122007-05-14 14:16
Case "add"
Name=htmlencode(request.form("Name"))
Qq=htmlencode(request.form("Qq"))
Mail=htmlencode(request.form("Mail"))
Info=htmlencode(request.form("Info"))
If Name="" or Qq="" or Mail="" or Info="" then
Response.Write "<script>alert('姓名、QQ、邮箱、留言必须填写!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Name)>16 then
Response.Write "<script>alert('姓名不要大于16个字符!');this.location.href='Index.asp';</SCRIPT>"
ElseIf not (isNumeric(Qq) or Qq="") then
Response.Write "<script>alert('QQ号码必须为数字!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Qq)<5 or len(Qq)>10 then
Response.Write "<script>alert('QQ号不要大于9个数字小于5个数字!');this.location.href='Index.asp';</SCRIPT>"
ElseIf Instr(Mail,".")<=0 or Instr(Mail,"@")<=0 then
Response.Write "<script>alert('邮箱必须包括(@)(.)!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Mail)>30 or len(Mail)<6 then
Response.Write "<script>alert('邮箱请不要大于30个汉字小于6个汉字!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Info)>400 then
Response.Write "<script>alert('留言内容不得大于400个字符!');this.location.href='Index.asp';</SCRIPT>"
Else
Set mRs= Server.CreateObject("adodb.recordSet")
mRs.open "Select * from book", conn, 1, 3
mRs.addnew
mRs("Name") = Name
mRs("Mail") = Mail
mRs("Qq") = Qq
mRs("Info") = Info
mRs("time") = now()
mRs.update
mRs.close

仅供参考!!
#3
kobe4122007-05-14 14:16
Case "add"
Name=htmlencode(request.form("Name"))
Qq=htmlencode(request.form("Qq"))
Mail=htmlencode(request.form("Mail"))
Info=htmlencode(request.form("Info"))
If Name="" or Qq="" or Mail="" or Info="" then
Response.Write "<script>alert('姓名、QQ、邮箱、留言必须填写!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Name)>16 then
Response.Write "<script>alert('姓名不要大于16个字符!');this.location.href='Index.asp';</SCRIPT>"
ElseIf not (isNumeric(Qq) or Qq="") then
Response.Write "<script>alert('QQ号码必须为数字!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Qq)<5 or len(Qq)>10 then
Response.Write "<script>alert('QQ号不要大于9个数字小于5个数字!');this.location.href='Index.asp';</SCRIPT>"
ElseIf Instr(Mail,".")<=0 or Instr(Mail,"@")<=0 then
Response.Write "<script>alert('邮箱必须包括(@)(.)!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Mail)>30 or len(Mail)<6 then
Response.Write "<script>alert('邮箱请不要大于30个汉字小于6个汉字!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Info)>400 then
Response.Write "<script>alert('留言内容不得大于400个字符!');this.location.href='Index.asp';</SCRIPT>"
Else
Set mRs= Server.CreateObject("adodb.recordSet")
mRs.open "Select * from book", conn, 1, 3
mRs.addnew
mRs("Name") = Name
mRs("Mail") = Mail
mRs("Qq") = Qq
mRs("Info") = Info
mRs("time") = now()
mRs.update
mRs.close
#4
kobe4122007-05-14 14:17
Case "add"
Name=htmlencode(request.form("Name"))
Qq=htmlencode(request.form("Qq"))
Mail=htmlencode(request.form("Mail"))
Info=htmlencode(request.form("Info"))
If Name="" or Qq="" or Mail="" or Info="" then
Response.Write "<script>alert('姓名、QQ、邮箱、留言必须填写!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Name)>16 then
Response.Write "<script>alert('姓名不要大于16个字符!');this.location.href='Index.asp';</SCRIPT>"
ElseIf not (isNumeric(Qq) or Qq="") then
Response.Write "<script>alert('QQ号码必须为数字!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Qq)<5 or len(Qq)>10 then
Response.Write "<script>alert('QQ号不要大于9个数字小于5个数字!');this.location.href='Index.asp';</SCRIPT>"
ElseIf Instr(Mail,".")<=0 or Instr(Mail,"@")<=0 then
Response.Write "<script>alert('邮箱必须包括(@)(.)!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Mail)>30 or len(Mail)<6 then
Response.Write "<script>alert('邮箱请不要大于30个汉字小于6个汉字!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Info)>400 then
Response.Write "<script>alert('留言内容不得大于400个字符!');this.location.href='Index.asp';</SCRIPT>"
Else
Set mRs= Server.CreateObject("adodb.recordSet")
mRs.open "Select * from book", conn, 1, 3
mRs.addnew
mRs("Name") = Name
mRs("Mail") = Mail
mRs("Qq") = Qq
mRs("Info") = Info
mRs("time") = now()
mRs.update
mRs.close
#5
kobe4122007-05-14 15:09
Case "add"
Name=htmlencode(request.form("Name"))
Qq=htmlencode(request.form("Qq"))
Mail=htmlencode(request.form("Mail"))
Info=htmlencode(request.form("Info"))
If Name="" or Qq="" or Mail="" or Info="" then
Response.Write "<script>alert('姓名、QQ、邮箱、留言必须填写!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Name)>16 then
Response.Write "<script>alert('姓名不要大于16个字符!');this.location.href='Index.asp';</SCRIPT>"
ElseIf not (isNumeric(Qq) or Qq="") then
Response.Write "<script>alert('QQ号码必须为数字!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Qq)<5 or len(Qq)>10 then
Response.Write "<script>alert('QQ号不要大于9个数字小于5个数字!');this.location.href='Index.asp';</SCRIPT>"
ElseIf Instr(Mail,".")<=0 or Instr(Mail,"@")<=0 then
Response.Write "<script>alert('邮箱必须包括(@)(.)!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Mail)>30 or len(Mail)<6 then
Response.Write "<script>alert('邮箱请不要大于30个汉字小于6个汉字!');this.location.href='Index.asp';</SCRIPT>"
ElseIf len(Info)>400 then
Response.Write "<script>alert('留言内容不得大于400个字符!');this.location.href='Index.asp';</SCRIPT>"
Else
Set mRs= Server.CreateObject("adodb.recordSet")
mRs.open "Select * from book", conn, 1, 3
mRs.addnew
mRs("Name") = Name
mRs("Mail") = Mail
mRs("Qq") = Qq
mRs("Info") = Info
mRs("time") = now()
mRs.update
mRs.close
#6
kidy20052007-05-16 16:06

没人会用ASP写注册页面的直接提示功能吗?我相信这里有的是人才,只要你们济点时间出来帮帮我嘛

#7
kidy20052007-05-20 10:11
你这些都是一般的注册页面添加代码啊?有没有那种如楼主说的那种?
#8
lmhllr2007-05-20 12:32

LZ是来要代码的还是讨论学习的???

1