<script language= "javascript ">
<!--
var msg = " ";
day = new Date();
h=day.getHours();
if ((h> =0) && (h <=4));
msg= "嘿嘿~今晚玩通宵啊?PFPF! ";
if((h> 4) && (h <7));
msg= "那么奋斗啊~~快早上了哦。。饿了就吃点东西吧 ";
if((h> =7) && (h <9));
msg= "这大清早的,早餐吃得好吧? ";
if((h> =9) && (h <12));
msg= "现在是工作的黄金时间哦 ";
if((h> =12)&&(h <13));
msg= "现在是午饭时间哦! ";
if((h> =13)&&(h <17));
msg= "下午的工作还满意吧?:) "
if((h> =17)&&(h <19));
msg= "晚饭吃了没有呢?出去散散步吧! "
if((h> =19)&&(h <22));
msg= "今晚有什么节目呢?好好玩啊! "
if((h> =22)&&(h <23));
msg= "该睡觉了...ZZZZ..... ";
document.write(msg);
//-->
</script>
------解决方案--------------------
<script language= "javascript ">
<!--
var msg = " ";
day = new Date();
h=day.getHours();
if ((h> =0)&&(h <=4))
{
msg= "嘿嘿~今晚玩通宵啊?PFPF! ";
}
if((h> 4) && (h <7)){
msg= "那么奋斗啊~~快早上了哦。。饿了就吃点东西吧 ";
}
if((h> =7) && (h <9))
{
msg= "这大清早的,早餐吃得好吧? ";
}
if((h> =9) && (h <12)){
msg= "现在是工作的黄金时间哦 ";
}
if((h> =12)&&(h <13)){
msg= "现在是午饭时间哦! ";
}
if((h> =13)&&(h <17)){
msg= "下午的工作还满意吧?:) ";
}
if((h> =17)&&(h <19)){
msg= "晚饭吃了没有呢?出去散散步吧! ";
}
if((h> =19)&&(h <22)){
msg= "今晚有什么节目呢?好好玩啊! ";
}
if((h> =22)&&(h <23)){
msg= "该睡觉了...ZZZZ..... ";}
document.write(msg);
-->
</script>
错误原因:1.if后面不应该有;号.2,分号有一部分是中文的