![]() |
#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 仅供参考!! |
就像http://register.9you.com/regist1.jsp中,当我打开该注册页面的时候用户名输入框后提示:用户名可使用数字、字母,长度为6-12,当我输入汉字的时候直接提示:用户名只可使用数字、字母
而当我输入数字或字母位数少于6位或者位数大于12位的石油直接提示:用户名长度只能为6-12位
以及正则表达式在Javascript脚本中如何应用:
我想将注册页面的用户名限制为6-12的数字或字母,在Javascript脚本中中如何应用\w{6,12}???
有谁可以将代码帖出来让大家分享下!!!
希望能够得到帮助!