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
仅供参考!!