ตัวอย่างด้านล่าง เป็น Code เปลี่ยนสีพื้นหลังและตัวอักษรตามเวลา
<SCRIPT>
<!--
var now = new Date();
var hours = now.getHours();
var psj=0;
//18-19 night
if (hours > 17 && hours < 20){
document.write('<body bgcolor="orange" text="green">')
}
//20-21 night
if (hours > 19 && hours < 22){
document.write('<body bgcolor="orangered" text="red">')
}
//22-4 night
if (hours > 21 || hours < 5){
document.write('<body bgcolor="black" text="orange">')
}
//9-17 day
if (hours > 8 && hours < 18){
document.write('<body bgcolor="deepskyblue" text="blue">')
}
//7-8 day
if (hours > 6 && hours < 9){
document.write('<body bgcolor="skyblue" text="deepskyblue">')
}
//5-6 day
if (hours > 4 && hours < 7){
document.write('<body bgcolor="steelblue" text="skyblue">')
}
//-->
</SCRIPT>
ขอบคุณที่มาจาก
http://www.codetukyang.com/java/time/code/code9.htm
แต่ผมอยากจะให้สีพื้นหลังและอักษรมันเปลี่ยนตามวันครับ เช่น
วันจันทร์ สีแดง
อังคาร สีเหลือง
จนถึงวันอาทิตย์ แล้วมันก็จะวนอยู่แบบนี้อะครับ
ขอบคุณมากครับ