[問題]顯示時間的程式碼問題

看板Web_Design作者 (Hug)時間19年前 (2006/12/13 16:34), 編輯推噓0(002)
留言2則, 1人參與, 最新討論串1/2 (看更多)
我用網頁特效精靈的,但預設是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 = "" +((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> <form name="clock"> <p><input name="thetime" style="font-size: 9pt;color:#000000;border:0" size="12"></p> </form> </body> </html> -- One More Time, Baby I don't wanna let you go One More Chance, It's only you, will always be with me I could never say goodbye to the days we spent, Oh baby stay with me One more time, time, time we spent One more chance, chance, chance with me One more kiss, kiss, kiss I want -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.67.78.174

12/13 17:17, , 1F
timeValue += ((hours >12) ? hours -12 :hours)
12/13 17:17, 1F

12/13 17:18, , 2F
這行在轉換..
12/13 17:18, 2F
文章代碼(AID): #15Vxiiec (Web_Design)
文章代碼(AID): #15Vxiiec (Web_Design)