注册 登录
编程论坛 ASP技术论坛

ASP最简单的问题

lele2007 发布于 2008-01-29 11:42, 703 次点击
<%
if time >=#6:00:00# and <=#11:29:00# then
response.write "早上好!今天又是新的开始!加油啊!"
elseif time >=#11:30:00# and <=#2:30:00# then
response.write "中午好!吃饱饭会更有精神哟!"
elseif time >=#2:31:00"# and <=#6:59:00# then
response.write "下午好!今天收获还不错吧!努力哟!"
elseif time >=#7:00:00# and <=#10:00:00# then
response.write "晚上好!是时候放松下心情了哟!"
else
response.write "夜深了!早点休息,注意身体别太晚哟!"
end if
%>
----------------------------------------------------------------------------
初学者一个,请问下这样编写怎么会出错的呢?
错误类型:
Microsoft VBScript 编译器错误 (0x800A03EA)
语法错误
/ok.asp, line 18, column 24
[bo]if time >=#6:00:00# and <=#11:29:00# then
-----------------------^
[/bo]
7 回复
#2
madpbpl2008-01-29 12:15
<%
if time >=#6:00:00# and time<=#11:29:00# then
response.write "早上好!今天又是新的开始!加油啊!"
elseif time >=#11:30:00# and time<=#2:30:00# then
response.write "中午好!吃饱饭会更有精神哟!"
elseif time >=#2:31:00# and time<=#6:59:00# then
response.write "下午好!今天收获还不错吧!努力哟!"
elseif time >=#7:00:00# and time<=#10:00:00# then
response.write "晚上好!是时候放松下心情了哟!"
else
response.write "夜深了!早点休息,注意身体别太晚哟!"
end if
%>
#3
flynet2008-01-29 13:47
if time >=#6:00:00# and time<=#11:29:00# then
#4
lele20072008-01-29 14:43
啊?忘记and 后面的time了,不过好像此段代码好像不能实现想要的功能的。只输入了最后那句话。

夜深了!早点休息,注意身体别太晚哟!

请问下哪里编写有错误的呢?
#5
天涯听雨2008-01-29 15:01
在Access 中: 时间要当字符进行处理,请加上''
#6
lele20072008-01-29 15:34
只是一个输出哟,我没有写到数据库里的。
#7
lele20072008-01-29 16:13
哦,明白了。
#8
lele20072008-01-29 16:25
糗大了
1