This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @descrition: 这个函数对输入的参数检查时候是合格的身份证号码,其身份证有效性无法判断。检测的颗粒度可以定制。 | |
* @param->str : 待验证的参数 | |
* @return : true是合格的身份证 false为不合法的身份证 | |
* | |
*/ | |
var checkIdCard = function (num) { | |
num = num.toUpperCase(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @description: 判断传入的参数的长度是否在给定的有效范围内 | |
* @param: minL->给定的最小的长度 | |
* @param: maxL->给定的最大的长度 | |
* @param: str->待验证的参数 | |
* @return : true表示合理,验证通过 | |
* | |
*/ | |
var isAvaiableLength = function(minL,maxL,str){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @descrition:判断输入的参数是否是个合格标准的邮箱,并不能判断是否有效,有效只能通过邮箱提供商确定。 | |
* @param:str ->待验证的参数。 | |
* @return -> true表示合格的邮箱。 | |
* | |
*/ | |
var isEmail = function(str){ | |
/** | |
* @descrition:邮箱规则 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @descrition:判断输入的参数是否是个合格的手机号码,不能判断号码的有效性,有效性可以通过运营商确定。 | |
* @param:str ->待判断的手机号码 | |
* @return: true表示合格输入参数 | |
* | |
*/ | |
var isCellphone = function(str) { | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @descrition:判断输入的参数是否是个合格的固定电话号码。 | |
* @param:str->待验证的固定电话号码。 | |
* @return : true表示验证合格。 | |
* | |
**/ | |
var isfixedphone = function(str) { | |
/** | |
* | |
* @desctition:规则->区号3-4位,号码7-8位,可以有分机号,分机号为3-4为,格式如下:"0775-85333333-123" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @descrition:判断输入的参数是否是个合格的QQ号码 | |
* @param->str:待验证的参数 | |
* @return: true验证成功 | |
*/ | |
var isQQ = function(str) { | |
/** | |
*@descrition:规则 | |
* 1-9开头,最少5位。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @descrition:判断输入的参数是否是国内合法的邮编地址(ps:国内不包含国外的邮编) | |
* @link: http://www.youbianku.com/%E9%A6%96%E9%A1%B5 | |
* @param: str为待验证的邮编号码 | |
* @return: true表示为合法的邮编号码 | |
* | |
*/ | |
var isPostcode = function(str) { | |
//国内邮编以0-8开头的6为数字 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @descrition:判断输入的参数是否是个合格的URL,由于url的灵活性和多样性,一下代码并不能测试所有的url都是合法的 | |
* @param:str->待判断的url参数 | |
* @return :true表示符合改正则。 | |
**/ | |
var isURL = function (str) { | |
var strRegex = "^((https|http|ftp|rtsp|mms)?://)" | |
+ "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@ | |
+ "(([0-9]{1,3}.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184 | |
+ "|" // 允许IP和DOMAIN(域名) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* @descrition:判断是否是合理的IP地址 | |
* @param:str->待验证的IP地址 | |
* @return :true合理的IP地址 | |
* | |
*/ | |
var isIP = function (str) { | |
var pattern = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* @description:在相应的元素上添加blur的样式 | |
* 兼容性:ie6-9、最新版chrome. | |
* | |
*/ | |
.blur { | |
background: rgba(0,0,0,0.5); | |
-webkit-filter: blur(3px); | |
-moz-filter: blur(3px); |