Re: [問題]顯示時間的程式碼問題
※ 引述《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
推
12/13 16:41, , 1F
12/13 16:41, 1F
討論串 (同標題文章)