记录几天后的日期
作者:晋城网站建设 日期:2010-02-15
演示:
脚本说明:
把如下代码加入<body>区域中
<script language="JavaScript">
<!-- Begin
function AddDays(form) {
DaysToAdd=document.form.DaysToAdd.value;
var now=new Date();
var newdate=new Date();
var newtimems=newdate.getTime()+(DaysToAdd*24*60*60*1000);
newdate.setTime(newtimems);
document.form.display.value=newdate.toLocaleString();
}
// End -->
</script>
<form name=form>
<input type=text name=DaysToAdd size=4 value=10 onFocus="this.select()" onMouseOver="this.focus()">
<input type=button value="天后的日期将是.." onClick="AddDays(this.form)" name="button">
<input type=text name="display" size=20 value="">
</form>