Board logo

標題: 時間顯示 [打印本頁]

作者: 蛙    時間: 18-5-2012 18:22     標題: 時間顯示

如不能顯示語法效果,可貼去本站語法測試板試看







<center> <script language="JavaScript">document.write("<span id='clock'></span>");
var now,hours,minutes,seconds,timeValue; function showtime(){ now = new Date();
hours = now.getHours(); minutes = now.getMinutes(); seconds = now.getSeconds();
timeValue = (hours >= 12) ? "下午 " : "上午 "; timeValue += ((hours > 12) ? hours - 12 : hours) + " 時";
timeValue += ((minutes < 10) ? " 0" : " ") + minutes + " 分";
timeValue += ((seconds < 10) ? " 0" : " ") + seconds + " 秒";
clock.innerHTML = timeValue; setTimeout("showtime()",100); }
showtime();</script> </center>

作者: 蛙    時間: 25-5-2013 16:15     標題: 複製上列語法








歡迎光臨 笨笨網站超級論壇 (http://www.bunbunhk.com/BBS/Discuz/) Powered by Discuz! 6.0.0