盾怪网教程:是一个免费提供流行杀毒软件教程、在线学习分享的学习平台!

ASP动态生成的javascript表单验证代码

时间:2024/10/28作者:未知来源:盾怪网教程人气:

[摘要]") '输出查询条件 Select Case tmpArr(i+1) Case "0" '必填的Text类型 findJS="...
")
  '输出查询条件
  Select Case tmpArr(i+1)
 
 
 Case "0"   '必填的Text类型
  findJS="if ((document."&frmName&"."&tmpArr(i)&".value)=="""")"&vbCrlf&_
     "{"&vbCrlf&_
"window.alert ('"&tmpArr(i+2)&"');"&vbCrlf&_
"document."&frmName&"."&tmpArr(i)&".select();"&vbCrlf&_
"document."&frmName&"."&tmpArr(i)&".focus();"&vbCrlf&_
"return false;"&vbCrlf&_
     "}"&vbCrlf

 Exit Function


    Case "1"  '必填的ListMenu类型
  findJS="if ((document."&frmName&"."&tmpArr(i)&".value)=="""")"&vbCrlf&_
         "{"&vbCrlf&_
         "window.alert ('"&tmpArr(i+2)&"');"&vbCrlf&_
         "document."&frmName&"."&tmpArr(i)&".focus();"&vbCrlf&_
"return false;"&vbCrlf&_
         "}"&vbCrlf
    Exit Function
 
 
    Case "2"  '必须为数字的Text类型
  findJS="if (isNaN(document."&frmName&"."&tmpArr(i)&".value))"&vbCrlf&_
         "{"&vbCrlf&_
         "window.alert ('"&tmpArr(i+2)&"');"&vbCrlf&_
"document."&frmName&"."&tmpArr(i)&".select();"&vbCrlf&_
         "document."&frmName&"."&tmpArr(i)&".focus();"&vbCrlf&_
"return false;"&vbCrlf&_
         "}"&vbCrlf
   Exit Function


    Case "3"  '必须为指定位数的Text类型
  findJS="if (document."&frmName&"."&tmpArr(i)&".value.length!="&tmpArr(i+3)&")"&vbCrlf&_
         "{"&vbCrlf&_
         "window.alert ('"&tmpArr(i+2)&"');"&vbCrlf&_
"document."&frmName&"."&tmpArr(i)&".select();"&vbCrlf&_
         "document."&frmName&"."&tmpArr(i)&".focus();"&vbCrlf&_
"return false;"&vbCrlf&_
         "}"&vbCrlf
   Exit Function


    Case "4"  '必须大于指定位数的Text类型
  findJS="if (document."&frmName&"."&tmpArr(i)&".value.length<"&tmpArr(i+3)&")"&vbCrlf&_
         "{"&vbCrlf&_
         "window.alert ('"&tmpArr(i+2)&"');"&vbCrlf&_
"document."&frmName&"."&tmpArr(i)&".select();"&vbCrlf&_
         "document."&frmName&"."&tmpArr(i)&".focus();"&vbCrlf&_
"return false;"&vbCrlf&_
         "}"&vbCrlf
   Exit Function


    Case "5"  '必须为Email的Text类型
  findJS="if ((!emailReg.test(document."&frmName&"."&tmpArr(i)&".value))&&(document."&frmName&"."&tmpArr(i)&".value!=''))"&vbCrlf&_
         "{"&vbCrlf&_
         "window.alert ('"&tmpArr(i+2)&"');"&vbCrlf&_
"document."&frmName&"."&tmpArr(i)&".select();"&vbCrlf&_
         "document."&frmName&"."&tmpArr(i)&".focus();"&vbCrlf&_
"return false;"&vbCrlf&_
         "}"&vbCrlf
   Exit Function


    Case "6"  '必须为a-z或0-9的字符的Text类型
  findJS="if ((!pwdReg.test(document."&frmName&"."&tmpArr(i)&".value))&&(document."&frmName&"."&tmpArr(i)&".value!=''))"&vbCrlf&_
         "{"&vbCrlf&_
         "window.alert ('"&tmpArr(i+2)&"');"&vbCrlf&_
"document."&frmName&"."&tmpArr(i)&".select();"&vbCrlf&_
         "document."&frmName&"."&tmpArr(i)&".focus();"&vbCrlf&_
"return false;"&vbCrlf&_
"}"&vbCrlf
   Exit Function


    Case "7"  '确认密码和密码必须相等的Text类型
  findJS="if ((document."&frmName&"."&tmpArr(i)&".value)!=(document."&frmName&"."&tmpArr(i+3)&".value))"&vbCrlf&_
         "{"&vbCrlf&_
         "window.alert ('"&tmpArr(i+2)&"');"&vbCrlf&_
"document."&frmName&"."&tmpArr(i)&".select();"&vbCrlf&_
         "document."&frmName&"."&tmpArr(i)&".focus();"&vbCrlf&_
"return false;"&vbCrlf&_
         "}"&vbCrlf
   Exit Function


    Case "8"  '确认以数字开头的Text类型
  findJS="if ((uidBeginReg.test(document."&frmName&"."&tmpArr(i)&".value))&&(document."&frmName&"."&tmpArr(i)&".value!=''))"&vbCrlf&_
         "{"&vbCrlf&_
         "window.alert ('"&tmpArr(i+2)&"');"&vbCrlf&_
"document."&frmName&"."&tmpArr(i)&".select();"&vbCrlf&_
         "document."&frmName&"."&tmpArr(i)&".focus();"&vbCrlf&_
"return false;"&vbCrlf&_
         "}"&vbCrlf
   Exit Function


    Case "9"  '确认10-101212格式的电话号码
  findJS="if ((!phoneReg.test(document."&frmName&"."&tmpArr(i)&".value))&&(document."&frmName&"."&tmpArr(i)&".value!=''))"&vbCrlf&_
         "{"&vbCrlf&_
         "window.alert ('"&tmpArr(i+2)&"');"&vbCrlf&_
"document."&frmName&"."&tmpArr(i)&".select();"&vbCrlf&_
         "document."&frmName&"."&tmpArr(i)&".focus();"&vbCrlf&_
"return false;"&vbCrlf&_
         "}"&vbCrlf
   Exit Function


    Case "10" '确认只包含英文字母及"-","_"在内的Text。(即不包括中文及其他特殊字符)
  findJS="if ((uidReg.test(document."&frmName&"."&tmpArr(i)&".value))&&(document."&frmName&"."&tmpArr(i)&".value!=''))"&vbCrlf&_
         "{"&vbCrlf&_
         "window.alert ('"&tmpArr(i+2)&"');"&vbCrlf&_
"document."&frmName&"."&tmpArr(i)&".select();"&vbCrlf&_
         "document."&frmName&"."&tmpArr(i)&".focus();"&vbCrlf&_
"return false;"&vbCrlf&_
         "}"&vbCrlf
   Exit Function


 Case "11"  '确认只包含数字及"-"在内的Text类型(电话号码及传真常用)
  findJS="if ((phoneDetailReg.test(document."&frmName&"."&tmpArr(i)&".value))&&(document."&frmName&"."&tmpArr(i)&".value!=''))"&vbCrlf&_
         "{"&vbCrlf&_
         "window.alert ('"&tmpArr(i+2)&"');"&vbCrlf&_
"document."&frmName&"."&tmpArr(i)&".select();"&vbCrlf&_
         "document."&frmName&"."&tmpArr(i)&".focus();"&vbCrlf&_
"return false;"&vbCrlf&_
         "}"&vbCrlf
  Exit Function
 

    Case "12"   '确认是否为有效网址!
  findJS="if (((!re1.test(document."&frmName&"."&tmpArr(i)&".value))&&(!re2.test(document."&frmName&"."&tmpArr(i)&".value))"&_
     "&&(document."&frmName&"."&tmpArr(i)&".value!=''))

关键词:ASP动态生成的javascript表单验证代码




Copyright © 2012-2018 盾怪网教程(http://www.dunguai.com) .All Rights Reserved 网站地图 友情链接

免责声明:本站资源均来自互联网收集 如有侵犯到您利益的地方请及时联系管理删除,敬请见谅!

QQ:1006262270   邮箱:kfyvi376850063@126.com   手机版