|
นำ
Code ไปวางไว้ในส่วนของ <HEAD>
<SCRIPT>
function tick() {
var hours, minutes, seconds, ap;
var intHours, intMinutes, intSeconds;
var today;
today = new
Date();
intHours =
today.getHours();
intMinutes = today.getMinutes();
intSeconds = today.getSeconds();
if (intHours
== 0) {
hours = "12:";
ap = "Midnight";
} else if (intHours < 12) {
hours = intHours+":";
ap = "A.M.";
} else if (intHours == 12) {
hours = "12:";
ap = "Noon";
} else {
intHours = intHours - 12
hours = intHours + ":";
ap = "P.M.";
}
if (intMinutes
< 10) {
minutes = "0"+intMinutes+":";
} else {
minutes = intMinutes+":";
}
if (intSeconds
< 10) {
seconds = "0"+intSeconds+" ";
} else {
seconds = intSeconds+" ";
}
timeString
= hours+minutes+seconds+ap;
Clock.innerHTML
= timeString;
window.setTimeout("tick();",
100);
}
window.onload
= tick;
</SCRIPT>
นำ
Code ไปวางไว้ในส่วนของ <Body> บริเวณที่คุณต้องการให้แสดงนาฬิกา
<DIV
align=center id=Clock style="COLOR:#FF6600;
FONT-FAMILY: Verdana; FONT-SIZE:20 px">...</DIV>
คุณสามารถเปลี่ยนขนาดฟอนต์ สี และแบบได้ตามที่คุณต้องการ

|