时间代码、年月日时分秒的即时显示
文章来源:小灰博客| 时间:2012-10-17 08:49:58| 作者:Leo | 0 条评论
一款很好用的时间代码!年月日时分秒的即时显示,实例请看本博客导航右侧时间栏!拿来分享给大家!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>网页特效-年月日时分秒的即时显示-www.qpsh.com</title> </head> <body onload=startclock()> <form name="clock"> <script language="JavaScript"> var timerID = null; var timerRunning = false; function stopclock (){ if(timerRunning) clearTimeout(timerID); timerRunning = false;} function startclock () { stopclock(); showtime();} function showtime () { var now = new Date(); var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds() var timeValue = now.getYear()+"年"+(now.getMonth()+1)+"月"+now.getDate()+"日" +((hours >= 12) ? " 下午 " : " 上午 " ) timeValue += ((hours >12) ? hours -12 :hours) timeValue += ((minutes < 10) ? ":0" : ":") + minutes timeValue += ((seconds < 10) ? ":0" : ":") + seconds document.clock.thetime.value = timeValue; timerID = setTimeout("showtime()",1000); timerRunning = true;} </script> <input name="thetime" style="font-size: 12pt;color:#000000;border:1px solid #FFFFFF; ; " size="28"></form> </body> </html> |
如果该文章帮到了您,不妨帮忙分享支持下博主!
同时也欢迎各位技术爱好者加入IT技术群(点击即可):70035098 互相交流学习!
同时也欢迎各位技术爱好者加入IT技术群(点击即可):70035098 互相交流学习!
分享该文章到: