搞了一天脑袋大了,请教高人

youanning 2009-08-28 02:27:35
列子能实现的:
if tpid="2" then
im=1
end if
if tpid="8" then
im=2
end if
if tpid="4" then
im=3
end if
if tpid="3" then
im=4
end if
if tpid="6" then
im=5
end if
if tpid="7" then
im=6
end if
%>
<td width="550" height="35">
<img src="../images/g<%=im%>.gif" width="273" height="36"></td>
能看不明白吧



我现在的问题是想把
if tpid="2" then
im=<font color=#996600>[行]</font>
end if
if tpid="8" then
im=<font color=#009966>[购]</font>
end if
if tpid="4" then
im=3
end if
if tpid="3" then
im=4
end if
if tpid="6" then
im=5
end if
if tpid="7" then
im=6
end if
%>
<td class="20"> <%=im%> <a href="<%=path%>guide/guideplay.asp?id=<%=rs("id")%>" target="_blank" title="<%=rs("title")%>"><%if i<5 then response.Write("<font color="&rs("ntitlecolor")&">") end if%><%=title%><%if i<5 then response.Write("</font>") end if%> </A></td>

意思就是说当TPID=2时 代码中就显示这样了:
<td class="20"> <font color=#996600>[行]</font> <a href="<%=path%>guide/guideplay.asp?id=<%=rs("id")%>" target="_blank" title="<%=rs("title")%>"><%if i<5 then response.Write("<font color="&rs("ntitlecolor")&">") end if%><%=title%><%if i<5 then response.Write("</font>") end if%> </A></td>


按列子是可以实现im=数字时候实现的图片! 但代码怎么实现啊 我不会 请教大家!

有1 2 3 4 5 这五个栏目,但我发个文章 在首页就显示(首页调用五个栏目最新文章),但不知道是那个栏目里的,现在想在前面做个标记,就知道这个文章属于那个栏目的了,

<tr>
<td class="news"><font color=#CC3399>[娱]</font> <a href="news/newsplay.asp?id=150" target="_blank" title="海南岛欢乐节开幕现场"><font color=#FF0000>海南岛欢乐节开幕现场</font></a></td>
</tr>

这是别人的 就是就是所这个文章属于娱乐 栏目里的,,这个不是调用数据库的 就根据TPID来显示的!

...全文
107 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
aim001 2009-08-29
  • 打赏
  • 举报
回复
if tpid="2" then
im= <font color=#996600>[行] </font>
end if
if tpid="8" then
im= <font color=#009966>[购] </font>
end if
if tpid="4" then
im="<img src=""../images/g 4.gif"" width=""273"" height=""36"">"
end if
ZSJ_COOL 2009-08-29
  • 打赏
  • 举报
回复
你的错误就是 没有写程序流程 光靠脑袋是记不住的 思维清晰写不出东西的原因
Alitech 2009-08-28
  • 打赏
  • 举报
回复
用Select Case 效率高些

另外,若非要这样写,试下

im= "<font color=#996600>[行] </font>"

远方 2009-08-28
  • 打赏
  • 举报
回复
用 select case语句

28,391

社区成员

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

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