One of the setting time for the setting time implemented by JavaScript, the feeling code implemented by jQuery is not concise. This is a JS code written by a colleague. I studied and learned it myself.
Copy code code as follows:
<! Doctype HTML PUBLIC "-// W3C // DTD XHTML 1.0 Transitional // EN" http://www.w3.org/xhtml1/dtddml1-transitationAl.dtd ">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "content-type" content = "text /html; charset = utf-8" /> />
<Title> Non -Title Document </Title>
<Style Type = "Text/CSS">
#LastDate {color:#ff9900; font-style: normal;}
</style>
</head>
<body>
<div>
<select id = "date_sel" name = "period">
<option value = "0"> within one day </option>
<option value = "1"> within two days </option>
<option value = "2"> within three days </option>
<option value = "3"> within four days </option>
</select>
<span> After <em ID = "LastDate"> 2012-9-28 </em>
</div>
<script type = "text/javascript">
document.GetelementByid ('date_sel'). Onchange = Function () {
var time = new date ();
var Pre_year = time.getfullyear ();
var Pre_month = time.getmonth ();
var Pre_dy = time.getdate ();
var sel_Day = PARSEINT (document.GetelementByid ('date_sel'). Value);
switch (sel_day) {
case 0: pre_dy += 1; break;
case 1: Pre_day += 2; BREAK;
Case 2: Pre_day += 3; BREAK;
Case 3: Pre_day += 4; Break;
default: Pre_day += 1; Break;
}
var Endtime = New Date (Pre_year, Pre_month, Pre_day);
document.GetelementByid ('LastDate'). Innerhtml = Endtime.getfullyear ()+"- "+(Endtime.getmonth ()+1)+"-"+Endtime.getdate ();
};
</script>
</body>
</html>