摘要:
function betweenDates(d1, d2){ var res = Math.abs(d1.getTime() - d2.getTime()); return res/1000/60/60/24; } function betweenDates(d1, d2){ var res = M 阅读全文
摘要:
function isLeapYear(year) { return year%400==0 || (year%4==0 && year%100!=0); } function isLeapYear(year) { return year%400==0 || (year%4==0 && year%1 阅读全文
摘要:
function string2date(str){ if( hasLetter(str) ) { throw new Error("哥们儿,你写错了!!"); } return new Date(str); } function string2date(str){ if( hasLetter(st 阅读全文
摘要:
function numberDoubled(n){ n = n+""; return n.length==1?"0"+n:n; } function date2string(d, sp){ sp = sp || "-"; var year = d.getFullYear(); var month 阅读全文
摘要:
function hasNumber(str) { for (var i in str) { var asc = str.charCodeAt(i); if (asc >= 48 && asc <= 57) { return true; } } return false; } function ha 阅读全文
摘要:
function hasLetter(str) { for (var i in str) { var asc = str.charCodeAt(i); if ((asc >= 65 && asc <= 90 || asc >= 97 && asc <= 122)) { return true; } 阅读全文
摘要:
function hasSpecial(str) { for (var i in str) { var asc = str.charCodeAt(i); if (!(asc >= 48 && asc <= 57 || asc >= 65 && asc <= 90 || asc >= 97 && as 阅读全文