日期:2014-05-16  浏览次数:20312 次

js得到某月有多少天

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XX?? http://www.cnblogs.com/goodspeed??? XX
XX?? /archive/2004/08/12/32551.html????? XX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//方法一
function DayNumOfMonth(Year,Month)
{
??? var d = new Date(Year,Month,0);
??? return d.getDate();
}
//方法二
function DayNumOfMonth(Year,Month)
{
??? Month--;
??? var d = new Date(Year,Month,1);
??? d.setDate(d.getDate()+32-d.getDate());
??? return (32-d.getDate());
}
//方法三
function DayNumOfMonth(Year,Month)
{
??? return 32-new Data(year,month,32).getData();
}