惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hacker News - Newest:
Hacker News - Newest: "LLM"
Project Zero
Project Zero
The Hacker News
The Hacker News
博客园 - Franky
博客园_首页
云风的 BLOG
云风的 BLOG
T
Tenable Blog
腾讯CDC
量子位
大猫的无限游戏
大猫的无限游戏
Cyberwarzone
Cyberwarzone
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
B
Blog
C
Cybersecurity and Infrastructure Security Agency CISA
宝玉的分享
宝玉的分享
T
The Blog of Author Tim Ferriss
P
Privacy & Cybersecurity Law Blog
小众软件
小众软件
Vercel News
Vercel News
Blog — PlanetScale
Blog — PlanetScale
The Cloudflare Blog
G
Google Developers Blog
Security Latest
Security Latest
I
Intezer
C
Cyber Attacks, Cyber Crime and Cyber Security
阮一峰的网络日志
阮一峰的网络日志
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
Microsoft Security Blog
Microsoft Security Blog
O
OpenAI News
AWS News Blog
AWS News Blog
WordPress大学
WordPress大学
MongoDB | Blog
MongoDB | Blog
C
Cisco Blogs
T
Tor Project blog
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
Last Week in AI
Last Week in AI
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
J
Java Code Geeks
D
Docker
A
About on SuperTechFans
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
News and Events Feed by Topic
Hacker News: Ask HN
Hacker News: Ask HN
Help Net Security
Help Net Security

博客园 - Magicam

vs2010 安装 Ajax Control Toolkit Backing up the tail mysql 1449 : The user specified as a definer ('root'@'%') does not exist 解决方法 WInform CMD command Mysql中的数据导入SQLServer2000 VS2010安装SP1后无法安装VS2010 SDK Vs2008调试Silverlight时,出现“未安装silverlight托管调试包” js 取时间代码 Sys.ArgumentOutOfRangeException: Value must be an integer 错误的原因 iframe - Magicam wia Kodak 扫描仪应用 winform - Magicam js实现: e.keycode详解 jquery 无法设置selected属性,未指明的错误 Mysql存储过程游标循环操作 JQuery ListBox间移动和ListBox内上下移动 Tif文件转换成GIF列表 - Magicam - 博客园 Visual Studio 2010 安装“deffactory.dat can not open” 的解决办法 - Magicam js 实现2列 div 自适应高度 - Magicam NetTiers模板属性说明 NHibernate配置引发的异常 - Magicam - 博客园
jquery easyui 扩展验证
Magicam · 2013-12-03 · via 博客园 - Magicam

$.extend($.fn.validatebox.defaults.rules, {

 idcard : {// 验证身份证 

        validator : function(value) { 

            return /^\d{15}(\d{2}[A-Za-z0-9])?$/i.test(value); 

        }, 

        message : '身份证号码格式不正确' 

    },

      minLength: {

        validator: function(value, param){

            return value.length >= param[0];

        },

        message: '请输入至少(2)个字符.'

    },

    length:{validator:function(value,param){ 

        var len=$.trim(value).length; 

            return len>=param[0]&&len<=param[1]; 

        }, 

            message:"输入内容长度必须介于{0}和{1}之间." 

        }, 

    phone : {// 验证电话号码 

        validator : function(value) { 

            return /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/i.test(value); 

        }, 

        message : '格式不正确,请使用下面格式:020-88888888' 

    }, 

    mobile : {// 验证手机号码 

        validator : function(value) { 

            return /^(13|15|18)\d{9}$/i.test(value); 

        }, 

        message : '手机号码格式不正确' 

    }, 

    intOrFloat : {// 验证整数或小数 

        validator : function(value) { 

            return /^\d+(\.\d+)?$/i.test(value); 

        }, 

        message : '请输入数字,并确保格式正确' 

    }, 

    currency : {// 验证货币 

        validator : function(value) { 

            return /^\d+(\.\d+)?$/i.test(value); 

        }, 

        message : '货币格式不正确' 

    }, 

    qq : {// 验证QQ,从10000开始 

        validator : function(value) { 

            return /^[1-9]\d{4,9}$/i.test(value); 

        }, 

        message : 'QQ号码格式不正确' 

    }, 

    integer : {// 验证整数 

        validator : function(value) { 

            return /^[+]?[1-9]+\d*$/i.test(value); 

        }, 

        message : '请输入整数' 

    }, 

    age : {// 验证年龄

        validator : function(value) { 

            return /^(?:[1-9][0-9]?|1[01][0-9]|120)$/i.test(value); 

        }, 

        message : '年龄必须是0到120之间的整数' 

    }, 

    chinese : {// 验证中文 

        validator : function(value) { 

            return /^[\Α-\¥]+$/i.test(value); 

        }, 

        message : '请输入中文' 

    }, 

    english : {// 验证英语 

        validator : function(value) { 

            return /^[A-Za-z]+$/i.test(value); 

        }, 

        message : '请输入英文' 

    }, 

    unnormal : {// 验证是否包含空格和非法字符 

        validator : function(value) { 

            return /.+/i.test(value); 

        }, 

        message : '输入值不能为空和包含其他非法字符' 

    }, 

    username : {// 验证用户名 

        validator : function(value) { 

            return /^[a-zA-Z][a-zA-Z0-9_]{5,15}$/i.test(value); 

        }, 

        message : '用户名不合法(字母开头,允许6-16字节,允许字母数字下划线)' 

    }, 

    faxno : {// 验证传真 

        validator : function(value) { 

//            return /^[+]{0,1}(\d){1,3}[ ]?([-]?((\d)|[ ]){1,12})+$/i.test(value); 

            return /^((\(\d{2,3}\))|(\d{3}\-))?(\(0\d{2,3}\)|0\d{2,3}-)?[1-9]\d{6,7}(\-\d{1,4})?$/i.test(value); 

        }, 

        message : '传真号码不正确' 

    }, 

    zip : {// 验证邮政编码 

        validator : function(value) { 

            return /^[1-9]\d{5}$/i.test(value); 

        }, 

        message : '邮政编码格式不正确' 

    }, 

    ip : {// 验证IP地址 

        validator : function(value) { 

            return /d+.d+.d+.d+/i.test(value); 

        }, 

        message : 'IP地址格式不正确' 

    }, 

    name : {// 验证姓名,可以是中文或英文 

            validator : function(value) { 

                return /^[\Α-\¥]+$/i.test(value)|/^\w+[\w\s]+\w+$/i.test(value); 

            }, 

            message : '请输入姓名' 

    },

    date : {// 验证姓名,可以是中文或英文 

        validator : function(value) { 

        //格式yyyy-MM-dd或yyyy-M-d

            return /^(?:(?!0000)[0-9]{4}([-]?)(?:(?:0?[1-9]|1[0-2])\1(?:0?[1-9]|1[0-9]|2[0-8])|(?:0?[13-9]|1[0-2])\1(?:29|30)|(?:0?[13578]|1[02])\1(?:31))|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)([-]?)0?2\2(?:29))$/i.test(value); 

        },

        message : '清输入合适的日期格式'

    },

    msn:{ 

        validator : function(value){ 

        return /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(value); 

    }, 

    message : '请输入有效的msn账号(例:abc@hotnail(msn/live).com)' 

    },

    same:{ 

        validator : function(value, param){ 

            if($("#"+param[0]).val() != "" && value != ""){ 

                return $("#"+param[0]).val() == value; 

            }else{ 

                return true; 

            } 

        }, 

        message : '两次输入的密码不一致!'    

    } 

});