<script language="Javascript"> Date.prototype.getDays=function(){ var newDate=new Date(); var newYear=newDate.getFullYear(); var newMonth=newDate.getMonth()+1; var R_year=false; R_year=((newYear%4==0&&newYear%100!==0)||newYear%400==0)?false:true; if(newMonth==1||newMonth==3||newMonth==5||newMonth==7||newMonth==8||newMonth==10||newMonth==12) month_len=31; else if(newMonth==2) month_len=(R_year)?28:29; else month_len=30; return month_len; } for(i=1;i<=(new Date().getDays());i++) document.write(i+" "); </script> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]