A:
function getDaysInMonth(year, month) {// 判断某年某月有多少天 month = parseInt(month, 10) + 1; var temp = new Date(year + "/" + month + "/0"); return temp.getDate(); }
B:
function getYearMonthDayNum(year,month){ var dayNum = [31,28,31,30,31,30,31,31,30,31,30,31]; if(new Date(year,1,29).getDate()==29){ dayNum[1] = 29; } return dayNum[month-1]; }
说明:其中A种实现不支持谷歌浏览器,而B种则支持更多