<script language="vbscript" runat="server">
dim a
a=Hour(Now)
IF a<12 or a>0 Then response.Write "早上好"
ElseIF a=12 Then response.Write "中午好"
ElseIF a<18 or a>12 Then response.Write "下午好"
ElseIF a<>0 or a>18 Then response.write "晚上好"
End IF
</script>
</body>
时间必须使用时间函数来进行判断,字符串不能使用大于或小于的符号来进行逻辑判断。
<%
dim a
a=hour(time)
Response.Write a
select case a
case a<"12:00"or a>"0:00"
response.Write "早上好"
case a>"12:00"
response.Write "啊好"
case a<"12:00" or a>"18:00"
response.Write "下午好"
case a<"18:00" or a>"0:00"
response.write "晚上好"
End select
dim a
a=Hour(Now)
IF a0 Then response.Write "早上好"
ElseIF a=12 Then response.Write "中午好"
ElseIF a12 Then response.Write "下午好"
ElseIF a0 or a>18 Then response.write "晚 ...