| Author |
help with if statement. searching for jpg or gif
|
|
| Zen Masta 2006-04-27, 7:51 am |
| 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>
| |
| Mike Brind 2006-04-27, 7:51 am |
|
Zen Masta wrote:
> 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")
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
| |
| Zen Masta 2006-04-27, 7:51 am |
| 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
------^
| |
| Mike Brind 2006-04-27, 7:51 am |
| "Zen Masta" <nospam@nospam.com> wrote in
news:eMFeOjzXGHA.3684@TK2MSFTNGP05.phx.gbl:
> 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
> ------^
>
>
>
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
| |
| Zen Masta 2006-04-27, 7:51 am |
| Still no luck.
yourcode
Microsoft VBScript compilation error '800a03f9'
Expected 'Then'
search.asp, line 909
elseif img_name=rs("ISBN")
--------------------------^
mine
Microsoft VBScript compilation error '800a03f9'
Expected 'Then'
/search2.asp, line 910
elseif img_name=rs("ISBN") & ".gif"
-----------------------------------^
| |
| Zen Masta 2006-04-27, 7:51 am |
| never mind, i had a typo. thanks !
| |
| Mike Brind 2006-04-27, 7:51 am |
| "Zen Masta" <nospam@nospam.com> wrote in news:eN1LIyzXGHA.3848
@TK2MSFTNGP05.phx.gbl:
> Still no luck.
> yourcode
> Microsoft VBScript compilation error '800a03f9'
> Expected 'Then'
> search.asp, line 909
How many??!?
> elseif img_name=rs("ISBN")
> --------------------------^
I don't see that line anywhere in the code I posted.
--
Mike Brind
| |
| Zen Masta 2006-04-27, 7:51 am |
| No, I got it to work I had just had a typo... I accidentally put the elseif
before img_name=rs("ISBN") instead of CheckPath
| |
| Mike Brind 2006-04-27, 7:51 am |
| "Zen Masta" <nospam@nospam.com> wrote in
news:ujRmK$zXGHA.3936@TK2MSFTNGP05.phx.gbl:
> No, I got it to work I had just had a typo... I accidentally put the
> elseif before img_name=rs("ISBN") instead of CheckPath
>
>
>
Given the number of lines in your search.asp, you might find some useful
advice here: http://www.aspfaq.com/show.asp?id=2424
--
Mike Brind
| |
| Zen Masta 2006-04-27, 7:51 am |
| Thanks for the link. I'll keep it for my own references. Unfortunately I'm
not really a programmer and so I'm not the one that wrote the site. I was
asking for help on this problem because the programmers were trying to tell
me it would take 8 hours to impliment this change on 6 pages. I knew this
was rediculously overtimed since I was able to figure out what changes need
to be made (with your help) with not much effort.
long story short programmers are from india
| |
| Bob Lehmann 2006-04-27, 7:51 am |
| > long story short programmers are from india
Yes, but they only get paid $5.00 an hour.
Bob Lehmann
"Zen Masta" <nospam@nospam.com> wrote in message
news:%23oXicX0XGHA.5012@TK2MSFTNGP05.phx.gbl...
> Thanks for the link. I'll keep it for my own references. Unfortunately I'm
> not really a programmer and so I'm not the one that wrote the site. I was
> asking for help on this problem because the programmers were trying to
tell
> me it would take 8 hours to impliment this change on 6 pages. I knew this
> was rediculously overtimed since I was able to figure out what changes
need
> to be made (with your help) with not much effort.
>
> long story short programmers are from india
>
>
|
|
|
|