当前位置:编程学习 > asp >>

asp表示时间代码

我的程序怎么不执行?是按书上抄的啊:
<% if time >=#11:00:00# and time < #14:00:00#
Then
words="中午好"
else
words="又来了啊!"
end if %>
<%=words%>

错误提示:
错误类型:
Microsoft VBScript compilation (0x800A03F9)
Expected 'Then'
/shijian.asp, line 11, column 42
if time >=#11:00:00# and time < #14:00:00#
-----------------------------------------^
补充:去掉#不管用
		
答案:
 if time >=#11:00:00# and time < #14:00:00#和Then要在同一行
应该是
<% if time >=#11:00:00# and time < #14:00:00# Then
words="中午好"
else
words="又来了啊!"
end if %>
<%=words%>
缺少THEN,有可能是>,换行,#等造成的,主要就是语法问题
Microsoft VBScript compilation (0x800A03F9)编译错误
Expected 'Then': 缺少THEN
/shijian.asp, line 11, column 42
if time >=#11:00:00# and time < #14:00:00# 不换行试下
答案补充
<% if time >=#11:00:00# and time < #14:00:00# Then
words="中午好"
else
words="又来了啊!"
end if %>
<%=words%>
把#号去掉
 time = hour(now)
if time >=11 and time < 14 then
.......
出错的是 if then 要放在一行上的

上一个:ASP.NET(C#)
下一个:asp.net页面显示问题

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,