首 页免费资源建站技术源码下载软件下载精品淘吧客户留言
用户登陆 | 用户注册
您当前的位置:笃志小屋建站技术特效代码日期时间 → 文章内容
在下拉式的Form框中显示时间
作者:佚名  来源:不详  发布时间:2007-9-29 22:38:47

在下拉式的Form框中显示时间


<!-- 网页特效代码由duzhi . net提供! -->
<!-- 要实现此效果需要 1 个步骤: -->

<!-- 第 1 步: -->
<!-- 把下面的代码加到<BODY></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>

2007-9-29 22:38:47免费资源duzhi.net

[ ] [返回上一页] [打 印]

【笃志小屋duzhi.net】

  技术文章导航
  技术文章排行
  精彩推荐
Copyright www.duzhi.net All Right Reserved.
设计制作:翼迅设计室 Equick Desgin Home 在线QQ:303471038
网络备案号:冀ICP备06008201号 站长信箱:webmaster#duzhi.net(将#换为@)
本站部分文章和图片来源于网络和内容提供伙伴,如果侵犯了您的权利,请留言告知,本站定会及时删除相关文件!