指引网

当前位置: 主页 > 编程开发 > ASP >

asp判断电话号与邮箱地址程序

来源:网络 作者:佚名 点击: 时间:2017-08-23 21:44
[摘要] 指引教程为您提供asp判断电话号与邮箱地址程序等资源,欢迎您收藏本站,我们将为您提供最新的asp判断电话号与邮箱地址程序资源
<script>ec(2);</script>

asp判断电话号与邮箱地址程序

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
' 判断电话号码是否正确
Function IsValidTel(para)
 Dim Str
 Dim l, i
 If IsNull(para) Then
  IsValidTel = false
  Exit Function
 End If
 Str = CStr(para)
 If Len(Trim(Str))<7 Then
  IsValidTel = false
  Exit Function
 End If
 l = Len(Str)
 For i = 1 To l
  If Not (Mid(Str, i, 1)>= "0" And Mid(Str, i, 1)<= "9" Or Mid(Str, i, 1) = "-") Then
   IsValidTel = false
   Exit Function
  End If
 Next
 IsValidTel = true
End Function

------分隔线----------------------------