chkinput.asp
资源名称:txl.zip [点击查看]
上传用户:comthink
上传日期:2021-05-06
资源大小:1280k
文件大小:2k
源码类别:
WEB源码(ASP,PHP,...)
开发平台:
HTML/CSS
- <%
- Rem ==========同学录通用函数=========
- '邮件有效检查
- 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 strLength(str)
- ON ERROR RESUME NEXT
- dim WINNT_CHINESE
- WINNT_CHINESE = (len("同学录")=3)
- if WINNT_CHINESE then
- dim l,t,c
- dim i
- l=len(str)
- t=l
- for i=1 to l
- c=asc(mid(str,i,1))
- if c<0 then c=c+65536
- if c>255 then
- t=t+1
- end if
- next
- strLength=t
- else
- strLength=len(str)
- end if
- if err.number<>0 then err.clear
- end function
- '标题缩短函数
- function cutStr(str,strlen)
- dim l,t,c
- l=len(str)
- t=0
- for i=1 to l
- c=Abs(Asc(Mid(str,i,1)))
- if c>255 then
- t=t+2
- else
- t=t+1
- end if
- if t>=strlen then
- cutStr=left(str,i)&"..."
- exit for
- else
- cutStr=str
- end if
- next
- cutStr=replace(cutStr,chr(10),"")
- end function
- %>
English
