JavaSctipt的问题

来源:百度知道 编辑:UC知道 时间:2024/05/30 11:46:38
<script language="javascript">
var a = new Date()
var b = a.getHours()
switch (b)
{
case 1 2 3 4 5 6:
document.write("凌晨好!!")
break
case 5 6 7:
document.write("早上好!!")
break
case 8 9 10 11:
document.write("上午好")
break
case 12 13 14 15 16 17 18:
document.write("下午好!!")
break
default:
document.write("晚上好!!")
}
</script>

这段代码那里写错了 谁能教教小弟啊我想做个分时问候 我的QQ382437496 或者留下你们的QQ

<script language="javascript">
var a = new Date();
var b = a.getHours();
switch (b)
{
case 1:
case 2:
case 3:
case 4:
document.write("凌晨好!!");
break;
case 5:
case 6:
case 7:
document.write("早上好!!");
break;
case 8:
case 9:
case 10:
case 11:
document.write("上午好");
break;
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
document.write("下午好!!");
break;
default:
document.write("晚上好!!");
}
记着写分号

switch (b)
{
case 1 2 3 4: //这里
document.write("凌晨好!!")
break
case 5 6 7:
document.write("早上好!!")
break
case 8 9 10 11:
document.write("上午好")
break
case 12 13 14 15 16 17 18:
document.write("下午好!!")
break
default: <