This file contains hidden or 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
| /* | |
| * @link :http://browserhacks.com/ | |
| * IE篇 | |
| */ | |
| var ie6=!-[1,]&&!window.XMLHttpRequest; //IE6为true,其他都为false | |
| var isIE = !!window.ActiveXObject; //ie6-10都为true, ie11为false | |
| /*返回IE6-9的版本号*/ | |
| var _IE = (function(){ | |
| var v = 3, div = document.createElement('div'), all = div.getElementsByTagName('i'); | |
| while ( |
This file contains hidden or 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
| input::-ms-clear { display: none; } //去掉input中的叉叉 | |
| input::-ms-reveal { display: none; } //去掉密码框中的小眼睛 |
This file contains hidden or 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 hidden or 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 hidden or 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为不合法的身份证 | |
| * | |
| */ | |
| function checkIdCard (num) { | |
| num = num.toUpperCase(); | |
This file contains hidden or 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
| /** | |
| * | |
| * @Dependence : https://gist.github.com/hehongwei44/3e167cfcda47d4c8051a#file-extendstringprototype-js | |
| * @description : 判断输入的参数是否为空 | |
| * @return : true表示为输入参数为空 | |
| * | |
| */ | |
| function isEmpty (str) { | |
| //空引用 空字符串 空输入 | |
| return str == null || typeof str == "undefined" || str.trim() == "" ? true : false; |
This file contains hidden or 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: 测试给定的参数是否全部为中文字符,如"中test"不会通过 。 | |
| * @param->str : 传入的参数,类型为字符串。 | |
| * @return : true表示全部为中文,false为不全是中文,或没有中文。 | |
| * | |
| */ | |
| var isChinese = function (str) { | |
| var pattern = /^[\u0391-\uFFE5]+$/g; | |
| return pattern.test(str); |
This file contains hidden or 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
| /** | |
| * 这里把符合以下条件的对象称为伪数组 | |
| * 1,具有length属性 | |
| * 2,按索引方式存储数据 | |
| * 3,不具有数组的push,pop等方法 | |
| * | |
| */ | |
| //将伪数组转换成数组,ps:已测试IE6-10、chrome、Firefox | |
| function toArray(arg){ |
This file contains hidden or 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
| /** | |
| * @function:generateRandomAlphaNum->生成随机的字符串 | |
| * @param:len->生存随机字符串的长度 | |
| * @tdd->IE6-9 chrome Firefox通过测试 | |
| * | |
| */ | |
| function generateRandomAlphaNum(len) { | |
| var rdmString = ""; | |
| //toSting接受的参数表示进制,默认为10进制。36进制为0-9 a-z | |
| for (var i=0; rdmString.length < len; rdmString += Math.random().toString(36).substr(2)); |
This file contains hidden or 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
| function ajax(url, fnOnSucc, fnOnFaild) | |
| { | |
| var oAjax=null; | |
| //1.初始化Ajax对象 | |
| if(window.ActiveXObject) | |
| { | |
| oAjax=new ActiveXObject("Msxml2.XMLHTTP")||new ActiveXObject("Microsoft.XMLHTTP"); | |
| } | |
| else |