今天发现了一款很酷的表单验证插件,来分享给大家。
页面底部有演示、免费下载链接。若是想看更多js特效、网站源码、 js教程请访问【素材火】 http://www.sucaihuo.com/js 还有演示DEMO,最主要是可以免费下载。1、<br>
HTML<br>
首先我们在页面上放置常用的表单元素:<br>
<dt>用户名:</dt>
<dd><input></dd> <br>
<dt>密码:</dt>
<dd><input></dd> <br>
<dt>确认密码:</dt>
<dd><input></dd> <br>
<dt>电子邮件:</dt>
<dd><input></dd> <br>
<dt>年龄:</dt>
<dd><input></dd> <br>
<dt> </dt>
<dd><button>提交</button></dd>
<br>
2、<br>
jQuery<br>
dbg = function(text) { <br>
$("#debug").html(text + ""); <br>
} <br>
var inputs = [{ <br>
name: "name", <br>
type: "chn", <br>
focusMsg: '中文', <br>
errorMsg: "您的大名", <br>
rightMsg: "填写正确", <br>
ajax: { <br>
url: "/home/ajax", <br>
errorMsg: "用户已存在", <br>
successMsg: "用户名可以注册!" <br>
} <br>
}, <br>
{ <br>
name: "pwd", <br>
type: 'eng', <br>
focusMsg: '英文', <br>
rightMsg: "填写正确", <br>
}, <br>
{ <br>
name: "pwd1", <br>
type: 'eq', <br>
errorMsg: "不匹配", <br>
eqto: 'pwd' <br>
}, <br>
{ <br>
name: "email", <br>
type: "email", <br>
focusMsg: '常用邮箱', <br>
rightMsg: "填写正确" <br>
}, <br>
{ <br>
name: "age", <br>
between: [18, 78], <br>
focusMsg: '1878' <br>
}]; <br>
<br>
var regulars = { <br>
"email": [/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/, "邮箱格式不对"], <br>
"username": [/^[#]/, "不能这样写"], <br>
"password": [/(lw)$/, "我要发火了"], <br>
"eng": [/^[A-Za-z]+$/, "只能输入英文"], <br>
"chn": [/^[\u0391-\uFFE5]+$/, "只能输入汉字"] <br>
} <br>
<br>
$("#ajax").checkInput({ <br>
inputs: inputs, <br>
beforeSubmit: function() {} <br>
});
查看该特效演示及免费下载,请访问【素材火】:http://www.sucaihuo.com/js/85.html
AD:真正免费,域名+虚机+企业邮箱=0元