每小時顯示不同訊息
- Internet Explorer 6.0
- Internet Explorer 7.0
- Internet Explorer 8.0
- Mozilla Firefox 2.0
- Mozilla Firefox 3.0
- Google Chrome
- Safari 3.1
- Opera 9.5
- 每小時顯示不同訊息 - 因應不同的時間顯示相對應的訊息。
- 語法總長度:1535 字元
<script type="text/javascript"><!--
var today = new Date ()
var hours = today.getHours();
if (hours <=0) document.write("午夜 12 點多了");
else if (hours <= 1) document.write("午夜 1 點多了");
else if (hours <= 2) document.write("午夜 2 點多了");
else if (hours <= 3) document.write("午夜 3 點多了");
else if (hours <= 4) document.write("午夜 4 點多了");
else if (hours <= 5) document.write("上午 5 點多了");
else if (hours <= 6) document.write("上午 6 點多了");
else if (hours <= 7) document.write("上午 7 點多了");
else if (hours <= 8) document.write("上午 8 點多了");
else if (hours <= 9) document.write("上午 9 點多了");
else if (hours <= 10) document.write("上午 10 點多了");
else if (hours <= 11) document.write("上午 11 點多了");
else if (hours <= 12) document.write("中午 12 點多了");
else if (hours <= 13) document.write("下午 1 點多了");
else if (hours <= 14) document.write("下午 2 點多了");
else if (hours <= 15) document.write("下午 3 點多了");
else if (hours <= 16) document.write("下午 4 點多了");
else if (hours <= 17) document.write("下午 5 點多了");
else if (hours <= 18) document.write("下午 6 點多了");
else if (hours <= 19) document.write("晚上 7 點多了");
else if (hours <= 20) document.write("晚上 8 點多了");
else if (hours <= 21) document.write("晚上 9 點多了");
else if (hours <= 22) document.write("晚上 10 點多了");
else if (hours <= 23) document.write("晚上 11 點多了");
// --></script>