帮助if语句。寻找jpg或gif [英] help with if statement. searching for jpg or gif
问题描述
原始代码:
<%img_name = rs(" ISBN")& " .JPG"如果CheckPath(img_name)= true则%>
< IMG src =" ../ images / 70pixelsTall /<%= rs(" ISBN")%> .jpg"宽度= QUOT; 50" height =" 70"
border = 0>
<%else%>
< img src =" .. /images/70pixelsTall/noimage70.jpg"宽度= QUOT; 50" height =" 70"
border = 0>
<%end if if%>
我想改变这样它也可以寻找GIF。如何在代码后添加
或更改原始代码,以便在jpg
无法检查/显示gif时显示。
<%img_name = rs(" ISBN")& " .gif要点"如果CheckPath(img_name)= true则%>
< IMG src =" ../ images / 70pixelsTall /<%= rs(" ISBN")%> .gif"宽度= QUOT; 50" height =" 70"
border = 0>
Original code:
<% img_name=rs("ISBN") & ".jpg" if CheckPath(img_name)=true then%>
<IMG src="../images/70pixelsTall/<%=rs("ISBN")%>.jpg" width="50" height="70"
border=0>
<% else %>
<img src="../images/70pixelsTall/noimage70.jpg" width="50" height="70"
border=0>
<%end if%>
I want to change this so that it also looks for gifs also. How can I add the
following code or change the original code so it checks/displays gifs if jpg
isn''t available.
<% img_name=rs("ISBN") & ".gif" if CheckPath(img_name)=true then%>
<IMG src="../images/70pixelsTall/<%=rs("ISBN")%>.gif" width="50" height="70"
border=0>
推荐答案
Zen Masta写道:
Zen Masta wrote:
原始代码:
<%img_name = rs(" ISBN")& " .JPG"如果CheckPath(img_name)= true则%>
< IMG src =" ../ images / 70pixelsTall /<%= rs(" ISBN")%> .jpg"宽度= QUOT; 50" height =" 70"
border = 0>
<%else%>
< img src =" ../ images / 70pixelsTall / noimage70.jpg"宽度= QUOT; 50" height =" 70"
border = 0>
<%end if if>
我想更改它,以便它也可以查找gif。如何添加
以下代码或更改原始代码,以便在jpg
不可用时检查/显示GIF。
<%img_name = rs(" ; ISBN")& " .gif要点"如果CheckPath(img_name)= true则%>
< IMG src =" ../ images / 70pixelsTall /<%= rs(" ISBN")%> .gif"宽度= QUOT; 50" height =" 70"
border = 0>
Original code:
<% img_name=rs("ISBN") & ".jpg" if CheckPath(img_name)=true then%>
<IMG src="../images/70pixelsTall/<%=rs("ISBN")%>.jpg" width="50" height="70"
border=0>
<% else %>
<img src="../images/70pixelsTall/noimage70.jpg" width="50" height="70"
border=0>
<%end if%>
I want to change this so that it also looks for gifs also. How can I add the
following code or change the original code so it checks/displays gifs if jpg
isn''t available.
<% img_name=rs("ISBN") & ".gif" if CheckPath(img_name)=true then%>
<IMG src="../images/70pixelsTall/<%=rs("ISBN")%>.gif" width="50" height="70"
border=0>
<%
img_name = rs(" ISBN")
如果CheckPath(img_name&" .jpg")= true则
%>
< IMG src =" ../ images / 70pixelsTall /<%= RS(" ISBN")%> .JPG" width =" 50"
height =" 70"
border = 0>
<%
elseif
CheckPath(img_name&" .gif")= true然后
%>
< IMG src =" ../images/70pixelsTall/<%=rs("ISBN")%>.gif" width =" 50"
height =" 70"
border = 0>
<%
else
%>
< img src =" ../ images / 70pixelsTall / noimage70.jpg"宽度= QUOT; 50" height =" 70"
border = 0>
<%end if if>
-
Mike Brind
<%
img_name=rs("ISBN")
if CheckPath(img_name & ".jpg")=true then
%>
<IMG src="../images/70pixelsTall/<%=rs("ISBN")%>.jpg" width="50"
height="70"
border=0>
<%
elseif
CheckPath(img_name & ".gif")=true then
%>
<IMG src="../images/70pixelsTall/<%=rs("ISBN")%>.gif" width="50"
height="70"
border=0>
<%
else
%>
<img src="../images/70pixelsTall/noimage70.jpg" width="50" height="70"
border=0>
<%end if%>
--
Mike Brind
谢谢。但这实际上是我最初尝试的,不完全是。你
把& " .JPG"在第二个括号内,我把它保留原样。
但是,我确实尝试将代码复制并粘贴到我的上面,我得到了相同的
语法错误:
Microsoft VBScript编译错误''800a03ea''
语法错误
/search.asp,第909行
elseif
------ ^
Thanks. But that''s actually what I tried originally, well not exactly. You
put the & ".jpg" inside the 2nd parentheses and I left it out as it was.
However, I did try to copy and paste your code over mine and I got the same
syntax error:
Microsoft VBScript compilation error ''800a03ea''
Syntax error
/search.asp, line 909
elseif
------^
" Zen Masta" <无**** @ nospam.com>写在
新闻:eM ************** @ TK2MSFTNGP05.phx.gbl:
"Zen Masta" <no****@nospam.com> wrote in
news:eM**************@TK2MSFTNGP05.phx.gbl:
谢谢。但这实际上是我最初尝试的,不完全是。
你放了& " .JPG"在第二个括号内,我把它留在了原来。但是,我确实尝试将代码复制并粘贴到我的上面并且我得到了相同的语法错误:
Microsoft VBScript编译错误''800a03ea''
语法错误
/search.asp,第909行
elseif
------ ^
Thanks. But that''s actually what I tried originally, well not exactly.
You put the & ".jpg" inside the 2nd parentheses and I left it out as
it was. However, I did try to copy and paste your code over mine and I
got the same syntax error:
Microsoft VBScript compilation error ''800a03ea''
Syntax error
/search.asp, line 909
elseif
------^
是的 - 谷歌推了一个在其他地方之后的行中断,那里不应该是b $ b。
ifif CheckPath(img_name&" .gif")= true然后
应该都在一行。
-
Mike Brind
Yeah - google shoved a line break after elseif where there shouldn''t be
one.
elseif CheckPath(img_name & ".gif")=true then
should all be on one line.
--
Mike Brind
这篇关于帮助if语句。寻找jpg或gif的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!