中文(繁体)
<!-- 完整的 HTML 程式碼如下--> <HTML> <TITLE>建站學院特效程式碼->>24/12 轉換時鐘</TITLE> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin函數showMilitaryTime() { if (document.form.showMilitary[0].checked) { return true; }返回假; } function showTheHours(theHour) { if (showMilitaryTime() || (theHour > 0 && theHour < 13)) { return (theHour); } } if (theHour == 0) { return (12); } return (theHour-12); } function showZeroFilled(inValue) { if (inValue > 9) { return "" + inValue; }返回“0”+inValue; } 函數 showAmPm() { if (showMilitaryTime()) { return (""); } } if (now.getHours() < 12) { return (" am"); } } 返回(「下午」); } function showTheTime() { now = new Date document.form.showTime.value = showTheHours(now.getHours()) + ":" + showZeroFilled(now.getMinutes()) + ":" + showZeroFilled(now.getSeconds( )) + showAmPm() setTimeout("showTheTime()",1000) } // End --> </script> <BODY onLoad="showTheTime()"> <!-- 第三步:新增最後一個程式碼HTML文件的正文--> <BODY> <center><form name=form> <input type=text name=showTime size=11><p> <input type=radio name=showMilitarychecked>24小時<br> <input type =radio name=showMilitary>12小時<br> </form></center>