easyui validatebox 验证集合
来源:互联网 发布:c语言怎么设置flag 编辑:程序博客网 时间:2024/04/29 00:51
Barney
【.net超级群:27921837】
easyui validatebox 验证集合
<html xmlns="http://www.w3.org/1999/xhtml"><head> <script src="easyui1.2.4/jquery-1.6.min.js" type="text/javascript"></script> <script src="easyui1.2.4/jquery.easyui.min.js" type="text/javascript"></script> <!--自定义验证--> <script src="easyui1.2.4/validator.js" type="text/javascript"></script> <link href="easyui1.2.4/themes/default/easyui.css" rel="stylesheet" type="text/css" /> <script> $(function () { //设置text需要验证 $('input[type=text]').validatebox(); }) </script></head><body> 邮箱验证:<input type="text" validtype="email" required="true" missingMessage="不能为空" invalidMessage="邮箱格式不正确" /><br /> 网址验证:<input type="text" validtype="url" invalidMessage="url格式不正确[http://www.example.com]" /><br /> 长度验证:<input type="text" validtype="length[8,20]" invalidMessage="有效长度8-20" /><br /> 手机验证:<input type="text" validtype="mobile" /><br /> 邮编验证:<input type="text" validtype="zipcode" /><br /> 账号验证:<input type="text" validtype="account[8,20]" /><br /> 汉子验证:<input type="text" validtype="CHS" /><br /> 远程验证:<input type="text" validtype="remote['checkname.aspx','name']" invalidMessage="用户名已存在"/></body></html>
自己写的validator.js
//扩展easyui表单的验证$.extend($.fn.validatebox.defaults.rules, { //验证汉子 CHS: { validator: function (value) { return /^[\u0391-\uFFE5]+$/.test(value); }, message: '只能输入汉字' }, //移动手机号码验证 mobile: {//value值为文本框中的值 validator: function (value) { var reg = /^1[3|4|5|8|9]\d{9}$/; return reg.test(value); }, message: '输入手机号码格式不准确.' }, //国内邮编验证 zipcode: { validator: function (value) { var reg = /^[1-9]\d{5}$/; return reg.test(value); }, message: '邮编必须是非0开始的6位数字.' }, //用户账号验证(只能包括 _ 数字 字母) account: {//param的值为[]中值 validator: function (value, param) { if (value.length < param[0] || value.length > param[1]) { $.fn.validatebox.defaults.rules.account.message = '用户名长度必须在' + param[0] + '至' + param[1] + '范围'; return false; } else { if (!/^[\w]+$/.test(value)) { $.fn.validatebox.defaults.rules.account.message = '用户名只能数字、字母、下划线组成.'; return false; } else { return true; } } }, message: '' }})
checkname.aspx
<%@ Page Language="C#" %><script runat="server"> void Page_Load(object sender, System.EventArgs e) { if (!string.IsNullOrEmpty(Request["name"])) { string name = ""; name = Request["name"]; if (name == "zhxhdean") {//当文本框中值为 zhxhdean,提示用户已存在。 这一步可以去数据库查询 Response.Write("false"); return; } else { Response.Write("true"); return; } } }</script>
0 0
- easyui validatebox 验证集合
- easyui validatebox 验证集合
- easyui validatebox 验证集合
- easyui validatebox 验证集合
- easyui validatebox 验证集合
- easyui validatebox 验证集合,自定义easyui验证规则
- easyui validatebox 验证集合,自定义easyui验证规则
- easyui validatebox 验证凑集
- easyui validatebox 验证类型
- easyui validatebox 验证类型
- easyui validatebox 验证类型
- easyui validatebox 验证类型
- easyui validatebox 验证类型
- easyui validatebox 验证类型
- easyui validatebox 验证类型
- EasyUI validatebox 自定义验证
- easyui validatebox 验证类型
- easyui validatebox 验证类型
- setInterval实现验证码倒数计时及与setTimeOut区别
- Javascript 识别iPhone、Android移动手机
- 驰骋工作流引擎-总体介绍
- Linux spi驱动分析(一)----总线驱动
- 并发闲聊–数据可见性
- easyui validatebox 验证集合
- 几款JavaScript开发框架、开发库
- iOS 图片等比压缩到指定尺寸
- RESTful Web 服务四种操作POST/DELETE/PUT/GET
- 编辑图片相关工具类
- WebService学习总结(三)——使用JDK开发WebService
- 类图中的关系
- java基础学习总结——抽象类
- android动态壁纸LiveWallpaper用法