日期星期時間
將下列程式碼複製至<body>程式碼</body>之間。
<script language="JavaScript"> <!-- var enabled = 0; today = new Date(); var day; var date; if(today.getDay()==0) day = "星期日" if(today.getDay()==1) day = "星期一" if(today.getDay()==2) day = "星期二" if(today.getDay()==3) day = "星期三" if(today.getDay()==4) day = "星期四" if(today.getDay()==5) day = "星期五" if(today.getDay()==6) day = "星期六" document.fgColor = "666666"; date = "<font style='color:#666666;font-size:9pt'>" + (today.getYear()) + "年" + (today.getMonth() + 1 ) + "月" + today.getDate() + "日• " + day +"</font>"; document.write("" + date.fontsize(3) + ""); --> </script><script language="JavaScript"> <!-- document.write("<font style='color:#666666;font-size:9pt'><span id='clock'></span></font>"); 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 + ""; clock.innerHTML = timeValue; setTimeout("showtime()",100); } showtime(); --> </script> |