📄 validate.asp
字号:
<%
'===========================================================
'useage:将要检查的参数用|分开,将参数出错的信息对应的顺序用|分开,直接调用即可
'Attention:checklen函数为检测长度,第一个参数为项目名,第二个参数为错误提示信息
'checkletter函数为过滤字符,第一个参数为要过滤的字符串,第二个为错误提示信息,第三个为要检测对应项目的过滤的字条串
'regulate函数为字条串的合法化,只有一个参数,将要合法化的字符串传入即可
'Copyright: 蔡志云
'UpDateTime: 10:43 2006-9-17
'=============================================================
'=========================
'检测相应项目是否填写
'=========================
'判断长度
sub checklen(str_check,str_info_temp)
str_err=split(str_check,"|")
str_info=split(str_info_temp,"|")
for i=0 to ubound(str_err)
if len(str_err(i))=0 then
str_info_show=str_info_show&str_info(i)
end if
next
if len(str_info_show)<>0 then
str_info_show_last=str_info_show
response.Write("<script language=javascript>window.alert('"&str_info_show_last&"');history.go(-1);</script>")
response.End()
end if
end sub
'================================
'检测过滤字符
'================================
sub checkletter(str_check,str_info_temp,str_pass)
str_err=split(str_check,"|")
str_info=split(str_info_temp,"|")
str_not=split(str_pass,"|")
for i=0 to ubound(str_err)
for k=0 to ubound(str_not)
if instr(str_err(i),str_not(k))>0 then
str_info_show=str_info_show&(i+1)&"."&str_info(i)
end if
next
next
'过滤最后一个|字符
if len(str_info_show)<>0 then
str_info_show_last=str_info_show
response.Write("<script language=javascript>window.alert('"&str_info_show_last&"');history.go(-1);</script>")
response.End()
end if
end sub
'==========================
'字条串长度合法化
'==========================
sub maxlen(str_regulate,str_err,max)
str_regulate=split(str_regulate,"|")
str_err=split(str_err,"|")
str_max=split(max,"|")
for i=0 to ubound(str_regulate)
if len(str_regulate(i))>cint(str_max(i)) then
str_info_show=str_info_show&str_err(i)
end if
next
if len(str_info_show)<>0 then
response.Write("<script language=javascript>window.alert('"&str_info_show&"');history.go(-1);</script>")
response.End()
end if
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -