/* 左边自动补零 质朴长存法 by lifesinger */ function pad(num, n) { var len = num.toString().length; while(len < n) { num = "0" + num; len++; } return num; }