常用的一些判断

dim c,words,word,i,wnum
function IsValiddomin(word)
IsValiddomin = true
words = Split(word, ".")
wnum=UBound(words)
if words(0)="www" then
IsValiddomin = IsValidword(words(1))
IsValiddomin = IsValidword2(words(2))
if words(wnum)="cn" then
if wnum<>3 then
IsValiddomin = false
exit function
end if
else
if wnum<>2 then
IsValiddomin = false
exit function
end if
end if
else
IsValiddomin = IsValidword(words(0))
IsValiddomin = IsValidword2(words(1))
if words(wnum)="cn" then
if wnum<>2 then
IsValiddomin = false
exit function
end if
else
if wnum<>1 then
IsValiddomin = false
exit function
end if
end if
end if
end function

function IsValidword2(word)
IsValidword2 = true
IsValidword2 = IsValidword(word)
if word<>"net" and word<>"com" and word<>"cc" and word<>"org" and word<>"info" and word<>"gov" then ' 自己添加
IsValidword2 = false
exit function
end if
end function

function IsValidword(word)
IsValidword = true

if Len(word) <= 0 then
IsValidword = false
exit function
end if
for i = 1 to Len(word)
c = Lcase(Mid(word, i, 1))
if InStr("abcdefghijklmnopqrstuvwxyz-", c) <= 0 and not IsNumeric(c) then
IsValidword = false
exit function
end if
next
end function

if IsValiddomin("wrclub.net.cn") then
response.write "right"
else
response.write "wrong"
end if

function nothaveChinese(para)
dim str
nothaveChinese=true
str=cstr(para)
for i = 1 to Len(para)
c=asc(mid(str,i,1))
if c<0 then
nothaveChinese=false
exit function
end if
next
end function

function isChinese(para)
on error resume next
dim str
dim i
if isNUll(para) then
isChinese=false
exit function
end if
str=cstr(para)
if trim(str)="" then
isChinese=false
exit function
end if
for i=1 to len(str)
c=asc(mid(str,i,1))
if c>=0 then
isChinese=false
exit function
end if
next
isChinese=true
if err.number<>0 then err.clear
end function

function IsValidEmail(email)
dim names, name, i, c
'Check for valid syntax in an email address.
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)
on error resume next
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
if err.number<>0 then err.clear
end function

10-28
10-30

10-26
10-11 1万+
08-05 1708
09-09 3830
10-22 2514
06-23 5880
11-29 5万+
06-28 5485
03-01 1万+
12-09 4410
04-05 1万+
03-10 6200
12-02 1212

“相关推荐”对你有帮助么？

• 非常没帮助
• 没帮助
• 一般
• 有帮助
• 非常有帮助

zhaohh

¥2 ¥4 ¥6 ¥10 ¥20

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、C币套餐、付费专栏及课程。