复制代码 代码如下: <BR>var today=new Date(); //定义当天日期对象 <BR>var year = today.getYear(); //获取年份 <BR>var month = today.getMonth(); //获取月份 <BR>var date = today.getDate(); //获取日期值 <BR>try{ <BR>//定义下个日期对象,日期值加上30天 <BR>var nextDay = new Date(year,month,date+30); <BR>//把下个日期对象信息打印出来 <BR>document.write(nextDay.getYear(),'<br>'); <BR>document.write(nextDay.getMonth()+1,'<br>'); <BR>document.write(nextDay.getDate(),'<br>'); <BR>}catch(e){ <BR>alert(e.message); <BR>} <BR> 运行结果: 2009 10 11