特定時間問候
將下列程式碼複製至<head>程式碼</head>區內。
<script LANGUAGE="JavaScript"> <!-- day = new Date() now = new Date() hr = day.getHours() hr1 = hr - 12 hr2 = 20 - hr if (now.getDay() == 5 && hr < 23 ) { document.write("<font color=blue>現在是星期五下午"+hr1+"點,今天再"+hr2+"個小時樂透開獎喔!") } else if (now.getDay() == 2 && hr < "23" ) { document.write("<font color=blue>現在是星期二下午"+hr1+"點,今天再"+hr2+"個小時樂透開獎喔!") } else if (now.getDay() == 3 && hr < "23" ) { document.write("<font color=blue>昨天開彩呢!手氣如何?") } else if (now.getDay() == 4 && hr < "23" ) { document.write("<font color=blue>明天開彩,加油加油!") } else if (now.getDay() == 6 && hr < "23" ) { document.write("<font color=blue>昨天開彩呢!手氣如何?</font>") } else if (now.getDay() == 0 && hr < "23" ) { document.write("<font color=blue>後天開彩唷!") } else if (now.getDay() == 1 && hr < "23" ) { document.write("<font color=blue>明天開彩,加油加油!") } //--> </script> |