help with if statement. searching for jpg or gif

Z

Zen Masta

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>
 
M

Mike Brind

Zen said:
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%>
 
Z

Zen Masta

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
------^
 
M

Mike Brind

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.
 
Z

Zen Masta

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"
-----------------------------------^
 
M

Mike Brind

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.
 
Z

Zen Masta

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
 
Z

Zen Masta

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
 
B

Bob Lehmann

long story short programmers are from india
Yes, but they only get paid $5.00 an hour.

Bob Lehmann
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top