js如何获取一个月的天数 function days(year,month){ var dayCount; now = new Date(year,month, 0); dayCount = now.getDate(); return dayCount; } alert(days(2014,7)) javascript获取一个月的天数…
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 ==…