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

(已解决)语法表达转换问题求解!

jiazehua 发布于 2010-08-27 16:26, 795 次点击
想修改的是这段代码:<%
                if rs("State")=0 then
                    response.write "<font color=red>待审核</font>"
                elseif rs("State")=1 then
                    response.write "<font color=blue>已审核</font>"
                elseif rs("State")=2 then
                                end if
                %>

                <a href="alipay/alipayto.asp?aliorder=<%=rs("OrderNo")%>&alimoney=<%=rs("RoomPrice")%>">支付宝支付</a>
我想实现的是,当订单为“已审核”状态时,显示链接“支付宝支付”
意思就是类似于:<%
                if rs("State")=0 then
                    response.write "<font color=red>待审核</font>"
                elseif rs("State")=1 then
                    response.write "<font color=blue>已审核</font>"
                elseif rs("State")=2 then

 <a href="alipay/alipayto.asp?aliorder=<%=rs("OrderNo")%>&alimoney=<%=rs("RoomPrice")%>">支付宝支付</a>
                                end if
                %>

当然这种表达式肯定是不对的,因为我不会代码,新手,不知道哪位能规范的写一下我这个功能?

答案:加一个IF语
<%if rs("State")=1 then
                    response.write
"<a href='alipay/alipayto.asp?aliorder="&rs("OrderNo")&"&alimoney="&rs("RoomPrice")&"'>支付宝支付</a>"
                    
end if
                    
%>



[ 本帖最后由 jiazehua 于 2010-8-27 21:07 编辑 ]
8 回复
#2
gupiao1752010-08-27 18:06
rs("State")=0表示未审核,rs("State")=1表示已经审核,那为何还要rs("State")=2这个状态呢??
改这样行吗?
程序代码:
<%
               
if rs("State")=0 then
                    response.write
"<font color=red>待审核</font>"
               
elseif rs("State")=1 then
                    response.write
"<font color=blue& gt;已审核</font><a href=""alipay/alipayto.asp?aliorder=& lt;%=rs(""OrderNo"")%>&alimoney=<%=rs(""RoomPrice"")%>""& gt;支付宝支付</a>"
                                
end if
               
%>

#3
hams2010-08-27 18:10
<%
                if rs("State")=0 then
                    response.write "<font color=red>待审核</font>"
                else
                    response.write "<a href='alipay/alipayto.asp?aliorder="&rs("OrderNo")&"&alimoney="&rs("RoomPrice")&"'>支付宝支付</a>"
                end if
                %>
            
#4
gupiao1752010-08-27 18:10
把代码放进去变行了。不好意思!
<%
                if rs("State")=0 then
                    response.write "<font color=red>待审核</font>"
                elseif rs("State")=1 then
                    response.write "<font color=blue>已审核</font><a href='alipay/alipayto.asp?aliorder="&rs("OrderNo")&"'>&alimoney="&rs("RoomPrice")&">支付宝支付</a>"
                                end if
                %>
#5
jiazehua2010-08-27 18:35
回复 2楼 gupiao175
又是你啊,貌似你升为斑竹了?哈哈
首先表示感谢~其次我想说,貌似代码不太对
我刚才是没发全部代码
截取的,怕混淆视听
现在把那一部分的代码都发出来你再帮我看看那~
程序代码:
<td align="center"><%
               
if rs("State")=0 then
                    response.write
"<font color=red>待审核</font>"
               
elseif rs("State")=1 then
                    response.write
"<font color=blue>已审核</font>"
               
elseif rs("State")=2 then
                    response.write
"<font color=gray>客户取消</font>"
               
elseif rs("State")=3 then
                    response.write
"<font color=gray>无效订单</font>"
               
elseif rs("State")=4 then
                    response.write
"<font color=green>成功订单</font>"
               
end if
               
%><br />
                <a href="alipay/alipayto.asp?aliorder=<%=rs("OrderNo")%>&alimoney=<%=rs("RoomPrice")%>">支付宝支付</a></td>
              </tr>
            </table></td>

#6
jiazehua2010-08-27 18:36
回复 3楼 hams
首先表示非常的非常的感谢~
耗费了您的时间来看我的问题
但是貌似代码不对
页面打不开了就
我把那部分的代码全放出来,麻烦您再看一下应该怎么写
程序代码:
<td align="center"><%
               
if rs("State")=0 then
                    response.write
"<font color=red>待审核</font>"
               
elseif rs("State")=1 then
                    response.write
"<font color=blue>已审核</font>"
               
elseif rs("State")=2 then
                    response.write
"<font color=gray>客户取消</font>"
               
elseif rs("State")=3 then
                    response.write
"<font color=gray>无效订单</font>"
               
elseif rs("State")=4 then
                    response.write
"<font color=green>成功订单</font>"
               
end if
               
%><br />
                <a href="alipay/alipayto.asp?aliorder=<%=rs("OrderNo")%>&alimoney=<%=rs("RoomPrice")%>">支付宝支付</a></td>
              </tr>
            </table></td>

#7
gupiao1752010-08-27 19:48
<tr><td align="center"><%
                if rs("State")=0 then
                    response.write "<font color=red>待审核</font>"
                elseif rs("State")=1 then
                    response.write "<font color=blue>已审核</font>"
                elseif rs("State")=2 then
                    response.write "<font color=gray>客户取消</font>"
%>
<a href="alipay/alipayto.asp?aliorder=<%=rs("OrderNo")%>&alimoney=<%=rs("RoomPrice")%>">支付宝支付</a></td>
<%
                elseif rs("State")=3 then
                    response.write "<font color=gray>无效订单</font>"
                elseif rs("State")=4 then
                    response.write "<font color=green>成功订单</font>"
                end if
                %>
                              </td></tr>
            </table>

直接加进去不就OK了。能否把你的要求再详细说明一下,发代码最好也发全了.这样比较好理解的意思,不然很容易让人误会!
#8
jiazehua2010-08-27 20:25
回复 7楼 gupiao175
嗯嗯……
您教育的是
我想达到的是只有当订单状态是:“已审核”
才显示支付链接字样……
#9
jiazehua2010-08-27 21:06
回复 7楼 gupiao175
谢谢了!
问题解决了
加了一个IF语句
<%if rs("State")=1 then
                    response.write"<a href='alipay/alipayto.asp?aliorder="&rs("OrderNo")&"&alimoney="&rs("RoomPrice")&"'>支付宝支付</a>"
                    end if
                    %>
1