ASP动态生成的javascript表单验证代码(8)
'4、Call CheckForm_js("formname,Guo_Error)
'www.china-u.com
'==========================================================
Dim Guo_Error
Guo_Error ="text|0|文本项必须填写!,"
Guo_Error = Guo_Error & "number|0|数字项必须填写且必须为数字!,"
Guo_Error = Guo_Error & "number|2|数字项必须为数字!,"
Guo_Error = Guo_Error & "digital|3|位数项必须为6位!|6,"
Guo_Error = Guo_Error & "moredigital|4|多位项必须大于4位!|4,"
Guo_Error = Guo_Error & "email|5|Mail项必须填写Email地址!,"
Guo_Error = Guo_Error & "caractor|6|字符项必须为0-9A-Z的字符!,"
Guo_Error = Guo_Error & "password2|7|确认密码必须与密码项保持一致!|password1,"
Guo_Error = Guo_Error & "listmenu|1|必须选择!"
Guo_Error = Guo_Error & "uid|8|用户名不能以数字开头!,"
Call CheckForm_js("form1",Guo_Error)
'==========================================================
' 表单验证流程
'==========================================================
'1、通过split(Guo_Error,".")拆分至数组tempArr();
'2、通过split(tempArr,"|")拆分至数组tempArr();
'3、Select Case split(tempArr(i+1),"|")执行验证及输出错误提示信息split(tempArr(i+2));
'4、javascript区分大小写地,所以各表单组件的名称都要注意书写一致哟~~
'==========================================================
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>表单验证实例</title>
</head>
<body>
<form name="form1" method="post" action="check_form.asp" onsubmit="javascript:return checkSubmit()">
<p align="center">待验证的表单</p>
***************************************************************
以上代码绝大多数已通过测试,不过是不是都好用,我只能说那个级联的下拉菜单用起来不太好用。看看哪位仁兄或WEB美眉加以改进喽。呵呵