ASP动态生成的javascript表单验证代码(2)
'15:确认未被禁用的Select类型必须选择 格式:检查的表单项|15|提示信息|关联项"
'注意:如有级联菜单,请将级联菜单的验证过程放到最后检验!!!!
'------------------------------------------------------------------------
%>
<%
Sub CheckForm_JS(frmName,errStr)
Dim tmpArr
Dim i
Dim strShow '输出JS的字符串
'获取错误列表,建立数组
tmpArr=Split(errStr,",")
'写JS
for i=0 to UBound(tmpArr)
if i<>0 then
strShow=strShow&"else "&findJS(frmName,tmpArr(i))
else
strShow=strShow&findJS(frmName,tmpArr(i))
end if
next
'输出
strShow="<script language=javascript>"&vbCrlf&_
"<!--"&vbCrlf&_
"//Power by Guoquanman 2004"&vbCrlf&_
"function checkSubmit()"&vbCrlf&_
"{"&vbCrlf&_
"var emailReg = /^[_a-z0-9]+@([_a-z0-9]+\.)+[a-z0-9]{2,3}$/;"&vbCrlf&_
"var pwdReg = /[a-z0-9]$/;"&vbCrlf&_
"var uidBeginReg = /^[0-9]+[_a-z0-9]/;"&vbCrlf&_
"var phoneReg = /\d{2}-\d{5}/;"&vbCrlf&_
"var phoneDetailReg = /[^0-9\-]/;"&vbCrlf&_
"var uidReg = /[^a-zA-Z0-9_\-]/;"&vbCrlf&_
"var htmlReg = /<(.*)>.*<\/\1>/;"&vbCrlf&_
"var re1 = /^http:\/\/[A-Za-z][A-Za-z0-9\-]*[A-Za-z]*\./;"&vbCrlf&_
"var re2 = /^http:\/\/[0-9]{1,5}[A-Za-z]*[0-9]*\./;"&vbCrlf&_
"var re3 = /\.{2,}/;"&vbCrlf&_
"var re4 = /\:{2,}/;"&vbCrlf&_
"var re5 = /\/{3,}/;"&vbCrlf&_
"var re6 = /\,+/;"&vbCrlf&_
"var re7 = /\!+/;"&vbCrlf&_
"var re8 = /\@+/;"&vbCrlf&_
"var re9 = /\#+/;"&vbCrlf&_
"var re10 = /\$+/;"&vbCrlf&_
"var re11 = /\^+/;"&vbCrlf&_
"var re12 = /\*+/;"&vbCrlf&_
"var re13 = /\|+/;"&vbCrlf&_
内容版权声明:除非注明,否则皆为本站原创文章。