日期:2014-05-17 浏览次数:20697 次
<input type="text" name="adddate" style="width:120px" readonly="readonly" />
<html> <head> <title>JavaScript计算日期10天前的日期</title> <meta http-equiv="content-Type" content="text/html;charset=gb2312"> </head> <body> <input type=text id="display" name="display" size=20 value=""> </body> </html> <script language="JavaScript"> function AddDays(DaysToAdd) { var now=new Date(); var newdate=new Date(); var newtimems=newdate.getTime()-(DaysToAdd*24*60*60*1000); newdate.setTime(newtimems); alert(newdate.toLocaleString()); return newdate.toLocaleString(); } document.getElementById("display").value=AddDays(10); </script>