表单问题,是个纠结的问题,我觉得这个是程序开发人员要去处理的东西,但是有时候程序又要前端去处理,那要看你的后台搭档怎么样了?苦逼的前端哇,不过还是自己了解一点还是比较好,你搞我也可以搞,你不搞我还可以搞,哈哈 。如果对你有用欢迎留言,共同探讨,共同进步,废话不说,贴代码(为了童鞋们方便,本代码复制即可用,无需分块拼凑): 复制代码 代码如下: 表单验证的完整应用 <BR>.leftside{width:100px; text-align:right;float:left;} <BR>label.error{color:#ea5200; margin-left:4px; padding:0px 20px; background:url(http://jt.875.cn/icon/unchecked.gif) no-repeat 2px 0 } <BR>label.right{margin-left:4px; padding-left:20px; background:url(http://jt.875.cn/icon/checked.gif) no-repeat 2px 0} <BR> <BR>$(function(){ <BR>$( "#regForm" ).validate({ <BR>rules: { <BR>// 注册用户名 <BR>username: { <BR>required: true, <BR>minlength: 5, <BR>maxlength: 12 <BR>}, <BR>// email <BR>email: { <BR>required: true, <BR>email: true <BR>}, <BR>// 密码 <BR>password: { <BR>required: true, <BR>minlength: 6, <BR>maxlength: 18 <BR>}, <BR>// 确认密码 <BR>confirm_password: { <BR>equalTo:"#password" <BR>}, <BR>// 检验验证码 <BR>captcha: { <BR>required: true, <BR>remote: "checkCaptcha.php" <BR>} <BR>}, <BR>messages: { <BR>// 注册用户名 <BR>username: { <BR>required: "此项不能为空", <BR>minlength: "不能少于5个字符", <BR>maxlength: "不能多于12个字符" <BR>}, <BR>// email <BR>email: { <BR>required: "此项不能为空", <BR>email: "email格式不正确" <BR>}, <BR>// 密码 <BR>password: { <BR>required: "此项不能为空", <BR>minlength: "不能少于6个字符", <BR>maxlength: "不能多于18个字符" <BR>}, <BR>// 确认密码 <BR>confirm_password: "两次输入密码不一致", <BR>// 检验验证码 <BR>captcha: { <BR>required: "请输入验证码", <BR>remote: "验证码输入错误" <BR>} <BR>} <BR>}); <BR>}); <BR> 姓名: 密码: 确认密码: EMAIL: 效果图如下