//填充固定位数 function pad(num, n) { var len = num.toString().length; while(len < n) { num = "0" + num; len++; } return num; }