function getDays() { //构造当前日期对象 var date = new Date(); //获取年份 var year = date.getFullYear(); //获取当前月份 var mouth = date.getMonth() + 1; //定义当月的天数: var days; //当月份为二月时,根据闰年还是非闰年判断天数 if (mouth == 2) { days = year % 4 == 0 ? 29 : 28; } else if (mouth ==…