Form中时间显示
下面为效果显示区!
17-05-125
========
01-05-125
02-05-125
03-05-125
04-05-125
05-05-125
06-05-125
07-05-125
08-05-125
09-05-125
10-05-125
11-05-125
12-05-125
13-05-125
14-05-125
15-05-125
16-05-125
17-05-125
18-05-125
19-05-125
20-05-125
21-05-125
22-05-125
23-05-125
24-05-125
25-05-125
26-05-125
27-05-125
28-05-125
29-05-125
30-05-125
31-05-125
脚本说明: 把如下代码加入<body>区域中 <FORM> <SELECT NAME="dates" SIZE=1> <SCRIPT LANGUAGE="JavaScript"> //-------------------------------------------- // By mattias.sjoberg@swipnet.se 26/7-97 // The JavaScript Planet // http://www.geocities.com/SiliconValley/7116 // You're welcome to use/edit this script, // just keep the comments and drop me a note. //-------------------------------------------- today = new Date(); thismonth = today.getMonth() + 1; thisyear = today.getYear(); thisday = today.getDate(); maxdays=31;//default // months with 30 days if (thismonth==4 || thismonth==6 || thismonth==9 || thismonth==11) { maxdays=30 } // february, leap year if (thismonth==2) { // feb if ((thisyear/4)!=parseInt(thisyear/4)) { maxdays=28 } else { //leap year maxdays=29 } } thismonth = "" + thismonth if (thismonth.length == 1) { thismonth = "0" + thismonth; } for (var theday = 0; theday <= maxdays; theday++) { if (theday == 0) { document.write ("<OPTION SELECTED> "+ thisday + "-" + thismonth + "-" + thisyear ) document.write ("<OPTION> ========") } else { var thed = "" + theday if (thed.length == 1) { thed = "0" + thed; } document.write ("<OPTION> " + thed + "-" + thismonth + "-" + thisyear) } } </SCRIPT> </SELECT> </FORM>