作者alpe (薛丁格的猫)
看板Web_Design
标题Re: [问题]显示时间的程式码问题
时间Wed Dec 13 16:37:50 2006
※ 引述《ckroy (Hug)》之铭言:
: 我用网页特效精灵的,但预设是12时制,请问要如何改成24时制,感谢!
: <html>
: <body onload="startclock()">
: <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 = "";
timeValue += hours;
: timeValue += ((minutes < 10) ? ":0" : ":") + minutes
: timeValue += ((seconds < 10) ? ":0" : ":") + seconds
: document.clock.thetime.value = timeValue;
: timerID = setTimeout("showtime()",1000);
: timerRunning = true;}
: </script>
: <form name="clock">
: <p><input name="thetime" style="font-size: 9pt;color:#000000;border:0"
: size="12"></p>
: </form>
: </body>
: </html>
--
Live Long and Prosper
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 203.67.68.236
1F:推 ckroy:感谢! 12/13 16:41