<%
'=================================================================
'Version:1.0
'Data=2004-7-5
'Script Written By: 幸福.net(Nicholas)
'==================================================================
'CopyRight By: 九州信息网络有限公司
'web: www.21hb.com
'email:nicholas_cheung@21cn.com
'==================================================================
Class Cls_Validator
Rem =======================验证类说明==============================
Rem=作用:对于输入数据的验证
Rem=例:set va=new Cls_Validator
Rem= va.Requirefield request("asd"),"错误请重新输入"
Rem=
Rem=
Rem==================================================================
Private Validator1,Validator2
Public Property Get Validator() '定义属性:验证
Validator=Validator1
End Property
Public Property Let Validator(Validator2)
Validator1=Validator2
End Property
Public Function Requirefield(requestfieled,errorname)'确保用户不跳输的方法 errorname是输入的字符串 requestname为错误信息
if requestfieled="" then
Requirefield=false
Validator1=false
Response.Write("<script lanuage='javascript'>alert('"&errorname&"');history.back()</script>")
Response.End()
else
Requirefield=true
Validator1=true
end if
End Function
Public Function CompareValidator(requestfieled1,requestfieled2,operator,errorname)'比较验证的方法 requestfieled1,requestfieled2为输入字符串 operator再比较符 errorname为错误信息
Select case operator '判断比较运算符
Case ">"
if (not requestfieled1>requestfieled2) then
CompareValidator=false
Validator1=false
Response.Write("<script lanuage='javascript'>alert('"&errorname&"');history.back()</script>")