有趣温馨的时间提示代码
代码如下:
<html> <head> <title>在不同的时间显示不同的提示信息</title> </head> <body> <script language="javascript"> <!-- d = new Date(); hours = d.getHours(); document.write("现在的时间是:"); document.write(hours, "时") document.write(d.getMinutes(), "分") document.write(d.getSeconds(), "秒"); if (hours == 1) msg = "烈火提示,零晨一点了,别忘了休息!"; if (hours == 2) msg = "该休息了,身体可是革命的本钱!"; if (hours == 3) msg = "夜深人静,只有你敲击键盘的声音..."; if (hours == 4) msg = "四点过去了,你明天不上班??"; if (hours == 5) msg = "哇,早上的阳光不错,该去晨练了!!"; if (hours == 6) msg = "你知道吗,此时是国内网络速度最快的时候!"; if (hours == 7) msg = "新的一天开始了,祝你过的快乐!"; if (hours == 8 || hours == 9 || hours == 10) msg = "上午好,你今天看上去很精神!"; if (hours == 11) msg = "十一点过了,快下班了吧?"; if (hours == 12) msg = "十二点过了,还没下班?"; if (hours == 13 || hours == 14) msg = "你不睡午觉?"; if (hours == 15 || hours == 16 || hours == 17) msg = "下午好"; if (hours == 18 || hours == 19) msg = "吃晚饭了吧?"; if (hours == 20 || hours == 21 || hours == 22) msg = "今天又在玩电脑,没节目?"; if (hours == 23) msg = "真是越玩越精神了,不打算睡了?"; if (hours == 0) msg = "凌晨了,还不睡?"; document.write("<br>提示信息:", msg); //--> </script> </body> </html>