ASP中IF语句问题

来源:百度知道 编辑:UC知道 时间:2024/06/18 12:06:50
<script language="vbscript">
dim curtime
curtime=time()
if curtime<#00:05:00# then document.write("上午")
else if curtime<#18:00:00# then document.write("下午")
else if curtime<#24:00:00# then document.write("晚上")
else document.write("出错了")
end if
</script>

这段有什么问题,老师讲的我照抄的, 不知道哪里出错了

<script language="vbscript" type="text/vbscript">
dim curtime
curtime=time()
if curtime<#00:05:00# then
document.write("上午")
elseif curtime< #18:00:00# then
document.write("下午")
elseif curtime< #23:59:59# then
document.write("晚上")
else
document.write("出错了")
end if
</script>

#24:00:00# 这里有问题,时间最大是23:59:59,再上去就是第二天的
00:00:00

第一句的点问题,可能你的条件是这样,在应该在中午十二点之前是上午吧,怎么你的在零点五分之前是上午。
<script language="vbscript" type="text/vbscript">
dim curtime
curtime=time()
if curtime<#05:00:00# then
document.write("凌晨")
elseif curtime<#12:00:00# then
document.write("上午")
elseif curtime< #18:00:00# then
document.write("下午")
elseif curtime< #23:59:59# then
document.write("晚上")
else
d