***时间日期***在下拉式的form框中显示时间
把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件要完成此效果把如下代码加入到<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>
--------------------------------------
http://www.huoyue.com.cn 活跃网,活跃人群的论坛,访问活跃网,将给您带来意想不到的收获,还可以免费为您开论坛,让您免费拥有与朋友、网友交流的论坛。你是年轻人吗?你活跃你就上!
页:
[1]