完善了上次的表单验证
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>表单提交验证测试用。。。。</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<link rel="stylesheet" href="../css/style.css" type="text/css" />
<link rel="stylesheet" href="../css/validator.css" type="text/css" />
<script type="text/javascript" src="judgeForm.js"></script>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
??? function handler(){????????????? //提交表单时自定义的方法
??????????? alert("我就是不提交");
??? ??? ??? return false;
??? ??? }
??? var config={?????????????? //配置对象 (目前必须按要求全部都配置,不然会报错的!)
??? ???? form:"myForm",
??? ??? ?submit:handler,
??? ??? ?elements:
??? ??? ?[
??? ??? ?{
??? ??? ?name:"userName",
??? ??? ??? ?tip:"s",
??? ??? ??? ?regxp:/^\w{6,12}$/g,
??? ??? ??? ?isNull:false,
??? ??? ??? ?defaultMsg:"用户名为6~12数!",
??? ??? ??? ?focus:"输入用户名",
??? ??? ??? ?errorMsg:"用户名不合法!",
??? ??? ??? ?rightMsg:"用户名可以使用!"
??? ??? ?},{
??? ??? ??? ? name:"password",
??? ??? ??? ?tip:"ss",
??? ??? ??? ?regxp:/^\w{6,12}$/g,
??? ??? ??? ?isNull:false,
??? ??? ??? ?defaultMsg:"密码为6~12数!",
??? ??? ??? ?focus:"输入密码",
??? ??? ??? ?errorMsg:"密码输入不合法!",
??? ??? ??? ?rightMsg:"密码格式正确!"
??? ??? ?
??? ??? ?}]};
???????? /**
??? ??? ??? 此超级简单的工具目前只能用于表单中的文本框验证,其他暂不支持!
??? ??? ??? (这个只是自己写了给自己以后看的,因为记忆力不好·~~)
??? ??? ?**/
??? ??? ?F.onReady(function(){????? //?? 加载类方法
??? ??? ??? var j=new JudgeForm(config);
??? ??? ??? j.register();
??? ??? })
??? ???
</SCRIPT>
<FORM METHOD=POST ACTION="" id="myForm" method="post">
用户名:<INPUT TYPE="text" NAME="userName" id="userName" /><font color="#669900" ><span id='s'></span></font><br>
密码:? <input type="password" id="password" /><font color="#669900" ><span id='ss'></span></font><br>
<INPUT TYPE="submit" value="提交" />
</FORM>
</BODY>
</HTML>