asp form 表單驗(yàn)證函數(shù)
更新時(shí)間:2009年01月13日 12:13:53 作者:
比較不錯(cuò)一些表單驗(yàn)證函數(shù),大家可以參考下
'*************************************
'檢測是否只包含英文和數(shù)字
'*************************************
Function IsvalidValue(ArrayN, Str)
IsvalidValue = False
Dim GName
For Each GName in ArrayN
If Str = GName Then
IsvalidValue = True
Exit For
End If
Next
End Function
'*************************************
'檢測是否有效的數(shù)字
'*************************************
Function IsInteger(Para)
IsInteger = False
If Not (IsNull(Para) Or Trim(Para) = "" Or Not IsNumeric(Para)) Then
IsInteger = True
End If
End Function
'*************************************
'用戶名檢測
'*************************************
Function IsValidUserName(byVal UserName)
Dim i, c
Dim VUserName
IsValidUserName = True
For i = 1 To Len(UserName)
c = LCase(Mid(UserName, i, 1))
If InStr("$!<>?#^%@~`&*();:+='"" ", c) > 0 Then
IsValidUserName = False
Exit Function
End If
Next
For Each VUserName in Register_UserName
If UserName = VUserName Then
IsValidUserName = False
Exit For
End If
Next
End Function
'*************************************
'檢測是否有效的E-mail地址
'*************************************
Function IsValidEmail(Email)
Dim names, Name, i, c
IsValidEmail = True
Names = Split(email, "@")
If UBound(names) <> 1 Then
IsValidEmail = False
Exit Function
End If
For Each Name IN names
If Len(Name) <= 0 Then
IsValidEmail = False
Exit Function
End If
For i = 1 To Len(Name)
c = LCase(Mid(Name, i, 1))
If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 And Not IsNumeric(c) Then
IsValidEmail = False
Exit Function
End If
Next
If Left(Name, 1) = "." Or Right(Name, 1) = "." Then
IsValidEmail = False
Exit Function
End If
Next
If InStr(names(1), ".") <= 0 Then
IsValidEmail = False
Exit Function
End If
i = Len(names(1)) - InStrRev(names(1), ".")
If i <> 2 And i <> 3 Then
IsValidEmail = False
Exit Function
End If
If InStr(email, "..") > 0 Then
IsValidEmail = False
End If
End Function
'檢測是否只包含英文和數(shù)字
'*************************************
Function IsvalidValue(ArrayN, Str)
IsvalidValue = False
Dim GName
For Each GName in ArrayN
If Str = GName Then
IsvalidValue = True
Exit For
End If
Next
End Function
'*************************************
'檢測是否有效的數(shù)字
'*************************************
Function IsInteger(Para)
IsInteger = False
If Not (IsNull(Para) Or Trim(Para) = "" Or Not IsNumeric(Para)) Then
IsInteger = True
End If
End Function
'*************************************
'用戶名檢測
'*************************************
Function IsValidUserName(byVal UserName)
Dim i, c
Dim VUserName
IsValidUserName = True
For i = 1 To Len(UserName)
c = LCase(Mid(UserName, i, 1))
If InStr("$!<>?#^%@~`&*();:+='"" ", c) > 0 Then
IsValidUserName = False
Exit Function
End If
Next
For Each VUserName in Register_UserName
If UserName = VUserName Then
IsValidUserName = False
Exit For
End If
Next
End Function
'*************************************
'檢測是否有效的E-mail地址
'*************************************
Function IsValidEmail(Email)
Dim names, Name, i, c
IsValidEmail = True
Names = Split(email, "@")
If UBound(names) <> 1 Then
IsValidEmail = False
Exit Function
End If
For Each Name IN names
If Len(Name) <= 0 Then
IsValidEmail = False
Exit Function
End If
For i = 1 To Len(Name)
c = LCase(Mid(Name, i, 1))
If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 And Not IsNumeric(c) Then
IsValidEmail = False
Exit Function
End If
Next
If Left(Name, 1) = "." Or Right(Name, 1) = "." Then
IsValidEmail = False
Exit Function
End If
Next
If InStr(names(1), ".") <= 0 Then
IsValidEmail = False
Exit Function
End If
i = Len(names(1)) - InStrRev(names(1), ".")
If i <> 2 And i <> 3 Then
IsValidEmail = False
Exit Function
End If
If InStr(email, "..") > 0 Then
IsValidEmail = False
End If
End Function
您可能感興趣的文章:
- JS組件Form表單驗(yàn)證神器BootstrapValidator
- AngularJS使用angular-formly進(jìn)行表單驗(yàn)證
- javascript Zifa FormValid 0.1表單驗(yàn)證 代碼打包下載
- jquery表單驗(yàn)證使用插件formValidator
- 基于Bootstrap+jQuery.validate實(shí)現(xiàn)Form表單驗(yàn)證
- jQuery 表單驗(yàn)證插件formValidation實(shí)現(xiàn)個(gè)性化錯(cuò)誤提示
- jQuery formValidator表單驗(yàn)證插件開源了 含API幫助、源碼、示例
- jQuery表單驗(yàn)證插件formValidator(改進(jìn)版)
- Validform+layer實(shí)現(xiàn)漂亮的表單驗(yàn)證特效
- 基于javascript的Form表單驗(yàn)證
相關(guān)文章
asp中利用CSW中文分詞組件來實(shí)現(xiàn)自己網(wǎng)站的內(nèi)容關(guān)鍵詞自動(dòng)提取
asp中利用CSW中文分詞組件來實(shí)現(xiàn)自己網(wǎng)站的內(nèi)容關(guān)鍵詞自動(dòng)提取...2007-03-03
asp 動(dòng)態(tài)生成rss(不成生xml文件)代碼
為你的網(wǎng)站添加rss閱讀功能 把以下文件保存為 rss.asp 放在網(wǎng)站的根目錄下 修改里面的幾個(gè)參數(shù)就可以2008-12-12
asp漢字中文圖片驗(yàn)證碼的實(shí)現(xiàn)代碼
asp漢字中文圖片驗(yàn)證碼的實(shí)現(xiàn)代碼...2007-11-11
GetPaing 函數(shù)之a(chǎn)sp采集函數(shù)中用到的獲取分頁的代碼
GetPaing 函數(shù)之a(chǎn)sp采集函數(shù)中用到的獲取分頁的代碼...2007-09-09
通過表單的做為二進(jìn)制文件上傳request.totalbytes提取出上傳的二級制數(shù)據(jù)
通過表單的做為二進(jìn)制文件上傳request.totalbytes提取出上傳的二級制數(shù)據(jù)的代碼說明。2009-09-09
如何在 Access 2003 和 Access 2002 中創(chuàng)建 DSN 的連接到 SQLServer 對鏈接表
如何在 Access 2003 和 Access 2002 中創(chuàng)建 DSN 的連接到 SQLServer 對鏈接表...2006-10-10

