一些靠谱的表单正则验证
2012-04-11 09:52
190 查看
function isInteger(obj){ reg=/^[-+]?\d+$/; if(!reg.test(obj)){ $("#test").html("<b>Please input correct figures</b>"); }else{ $("#test").html(""); } } function isEmail(obj){ reg=/^\w{3,}@\w+(\.\w+)+$/; if(!reg.test(obj)){ $("#test").html("<b>请输入正确的邮箱地址</b>"); }else{ $("#test").html(""); } } function isString(obj){ reg=/^[a-z,A-Z]+$/; if(!reg.test(obj)){ $("#test").html("<b>只能输入字符</b>"); }else{ $("#test").html(""); } } function isTelephone(obj){ reg=/^(\d{3,4}\-)?[1-9]\d{6,7}$/; if(!reg.test(obj)){ $("#test").html("<b>请输入正确的电话号码!</b>"); }else{ $("#test").html(""); } } function isMobile(obj){ reg=/^(\+\d{2,3}\-)?\d{11}$/; if(!reg.test(obj)){ $("#test").html("请输入正确移动电话"); }else{ $("#test").html(""); } } function isUri(obj){ reg=/^http:\/\/[a-zA-Z0-9]+\.[a-zA-Z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>\"\"])*$/; if(!reg.test(obj)){ $("#test").html($("#uri").val()+"请输入正确的inernet地址"); }else{ $("#test").html(""); } }
关于.NET技术 等其他计算机技术,欢迎加群一起讨论 3群 70536418 2群 5851499 1群 12672376
相关文章推荐
- 一些表单验证常用的正则表达式收集
- 表单验证的一些正则表达式
- 一些表单验证常用的正则表达式收集
- JQuery入门常用的一些方法、表单操作、正则验证
- 一些表单验证常用的正则表达式收集
- 正则表达式表单验证
- JavaScript表单通过正则表达式验证电话号码
- ExtJS textField 表单验证 常用正则表达式
- 表单 数字字符验证正则
- 一些有用的js正则验证(是否为空,是否为正整数,email,手机,电话,身份证)
- PHP使用正则匹配进行表单验证案例
- javaScript表单正则表达式验证代码全集
- js 表单正则验证
- JavaScript通过正则表达式实现表单验证电话号码
- JavaScript 使用正则表达式进行表单验证的示例代码
- js 常用正则表达式表单验证代码
- 运用正则做简单的表单验证
- yii 使用cactiveform 创建表单时候遇到的一些验证问题和使用ajax_form时重置验证规则的解决办法
- 表单验证常用正则