切纸机刀片怎么磨:asp 判断是否为email函数的问题

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/19 15:06:39
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

上面是函数,下面引用如:
if IsValidEmail(email)=false then

Response.write"<script language=javascript>window.alert('请正确填写email');history.back(1);</script>"
Response.End
End If

这样写但是说Microsoft VBScript 运行时错误 (0x800A000D)
类型不匹配: 'IsValidEmail'

为什么会这样?要怎样改呢?