記錄幾天后的日期
作者:晉城網站建設 日期: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>