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

日期时间都在一个按钮上显示


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

<!-- 第 1 步: -->
<!-- 把<BODY>中的属性代码改为: -->

<BODY onLoad="startclock ()">



<!-- 第 2 步: -->
<!-- 把下面的代码加到<BODY></BODY>区域中: -->

<script language="Javascript">

var timerID = null;

var timerRunning = false;

// Called by both onLoad in BODY tag, and Resume button.

function startclock ()

{

// Make sure the clock is stopped

stopclock();

time();

}

// Kills clock.

function stopclock ()

{

if(timerRunning)

clearTimeout(timerID);

timerRunning = false;

}

function time ()

{

var now = new Date();

var yr = now.getYear();

var mName = now.getMonth() + 1;

var dName = now.getDay() + 1;

var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate();

var ampm = (now.getHours() >= 12) ? " P.M." : " A.M."

var hours = now.getHours();

hours = ((hours > 12) ? hours - 12 : hours);

var minutes = ((now.getMinutes() < 10) ? ":0" : ":") +

now.getMinutes();

var seconds = ((now.getSeconds() < 10) ? ":0" : ":") +

now.getSeconds();

if(dName==1) Day = "Sunday";

if(dName==2) Day = "Monday";

if(dName==3) Day = "Tuesday";

if(dName==4) Day = "Wednesday";

if(dName==5) Day = "Thursday";

if(dName==6) Day = "Friday";

if(dName==7) Day = "Saturday";

if(mName==1) Month="January";

if(mName==2) Month="February";

if(mName==3) Month="March";

if(mName==4) Month="April";

if(mName==5) Month="May";

if(mName==6) Month="June";

if(mName==7) Month="July";

if(mName==8) Month="August";

if(mName==9) Month="September";

if(mName==10) Month="October";

if(mName==11) Month="November";

if(mName==12) Month="December";

// String to display current date.

var DayDateTime=(" "

+ Day

+ " "

+ Month

+ " "

+ dayNr

+ ", "

+ ""

+ yr

+ " "

+ hours

+ minutes

+ seconds

+ " "

+ ampm

);

// Displays Day-Date-Time on the staus bar.

document.clock.face.value=DayDateTime;

timerID = setTimeout("time()",1000);

timerRunning = true;

}

// Stops clock and clears status bar.

function clearStatus()

{

if(timerRunning)

clearTimeout(timerID);

timerRunning = false;

window.status=" ";

}

// -- End Hiding Here -->

</script>

<form name="clock" onSubmit="0">

<input type=button name="face" size=100 value=" Javascript!! ">

</form>

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

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

【笃志小屋duzhi.net】

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