129、记录几天后的日期

129、记录几天后的日期

脚本说明:

把如下代码加入<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>

 

Write a comment

Comments: 0