紧急求助啊!!!

yanglc02 2012-04-18 10:16:02
为什么在编代码的时候不能用回车键啊。用了就报错。比如<%if()then() end if%>这样了在end if前面打了个回车就出错了怎么回事啊
<%if()then()
end if%>
还有 <%if ( (rs("t_expire")<date()) and (rs("t_commend")=0) ) then response.write ("a") elseif ((rs("t_expire")>=date()) and( rs("t_commend")=0)) then response.write ("b") elseif (rs("t_commend")=1) then response.write ("c") end if %>这段代码写错了吗 去掉两个elseif没错加上就一直出错,老说语句未结束。结束了啊。求哪位大哥帮帮忙,小弟拜谢!!
...全文
136 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
yanglc02 2012-04-18
  • 打赏
  • 举报
回复
[Quote=引用 14 楼 的回复:]
VBScript code


<%
if ( (rs("t_expire")<date()) and (rs("t_commend")=0) )then
response.write ("a")
elseif ((rs("t_expire")>=date()) and( rs("t_commend")=0)) then
response.write ("b")……
[/Quote]
感谢了,感谢国家好了。多谢各位了。刚开始用asp太笨了,也真的哪里找资料,自己捉摸。基础确实差。再次谢谢各位了。解决了。感谢国家!
文盲老顾 2012-04-18
  • 打赏
  • 举报
回复
。。。。这些是基础啊

If 条件 Then ,If 和 Then 必须在同一行

If 条件 Then 语句,当条件满足执行的语句也在同一行时,无End If

If 条件 Then 语句 Else 语句,含 Else 时同上

If 条件 Then
语句
End If,当条件满足执行的语句与判断不在同一行时,即 Then 后无其他语句时,需要End If结束,End If必须单独占一行,如包含Else,则Else同样需要单独占一行

基础知识啊。。。。
hookee 2012-04-18
  • 打赏
  • 举报
回复

<%
if ( (rs("t_expire")<date()) and (rs("t_commend")=0) )then
response.write ("a")
elseif ((rs("t_expire")>=date()) and( rs("t_commend")=0)) then
response.write ("b")
elseif (rs("t_commend")=1 ) then
response.write ("c")
end if
%>

yanglc02 2012-04-18
  • 打赏
  • 举报
回复
真是急死了
yanglc02 2012-04-18
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 的回复:]
<%if()then()
end if%>
想问下楼主。。楼主怎么看<%..%>这对符号的。。
[/Quote]
没什么看法就是 写什么输出什么的用啊 具体是怎么的啊 能教我下么,现在我愁死了,大哥,帮帮我好么
三石-gary 2012-04-18
  • 打赏
  • 举报
回复
<%if()then()
end if%>
想问下楼主。。楼主怎么看<%..%>这对符号的。。
三石-gary 2012-04-18
  • 打赏
  • 举报
回复
真看不出来有什么问题。。纠结
三石-gary 2012-04-18
  • 打赏
  • 举报
回复
http://zhidao.baidu.com/question/38562595
yanglc02 2012-04-18
  • 打赏
  • 举报
回复
<%if ( (rs("t_expire")<date()) and (rs("t_commend")=0) )
then response.write ("a")
elseif ((rs("t_expire")>=date()) and( rs("t_commend")=0))
then response.write ("b")
elseif (rs("t_commend")=1 )
then response.write ("c")
end if %>
这段代码难道没有结束吗?结束了啊,检查了好多遍了 怎么回事啊。
yanglc02 2012-04-18
  • 打赏
  • 举报
回复
烦死了 烦死了谁可以帮帮我啊
yanglc02 2012-04-18
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 的回复:]
if then 写在一行的时候不加end if,写多行的时候才要加end if
If xx Then xx
或者

if xx then
xxx
end if

同理,if else 也是一样,写在一行就不用加end if,写多行必须
if xx then xx else xx

if xx then
xx
else
xx
end if
[/Quote]
还有这回事啊,可是不是用不用end if的问题呢, 而是我用了回车换行就出现错误了。用空格敲到第二行就没错误,为什么啊,不知道怎么回事,
wzhiyuan 2012-04-18
  • 打赏
  • 举报
回复
if then 写在一行的时候不加end if,写多行的时候才要加end if
If xx Then xx
或者

if xx then
xxx
end if

同理,if else 也是一样,写在一行就不用加end if,写多行必须
if xx then xx else xx

if xx then
xx
else
xx
end if
yanglc02 2012-04-18
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 的回复:]
<%if()then() end if%>
是不是后面不能用括号。。而是直接写语句就OK。。
[/Quote]
我没用括号,我只是用括号表示下语句
yanglc02 2012-04-18
  • 打赏
  • 举报
回复
我没用括号,我只是用括号表示下语句
三石-gary 2012-04-18
  • 打赏
  • 举报
回复
<%if()then() end if%>
是不是后面不能用括号。。而是直接写语句就OK。。
yanglc02 2012-04-18
  • 打赏
  • 举报
回复
太烦恼了,真诡异

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧