mattybrigh,
I recommend you change to a Select Case (http://www.tizag.com/aspT
Let me know if you have any questions or need more information.
b0lsc0tt
Main Topics
Browse All TopicsI'm doing some navigation in .asp and need a bit of help with my if...then statement.
Bascially, here's what I have so far (this works, but I'm compounding the problem by using multiple directories).
<% If Instr(directory, "/images/") > 0 Then %><td valign="top" colspan="2" style="background:url(navb
I want to take that and replace <%else%> with <%elseif%>directory 2, <%elseif%> directory 3, etc...
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
mattybrigh,
I recommend you change to a Select Case (http://www.tizag.com/aspT
Let me know if you have any questions or need more information.
b0lsc0tt
As others have already said, a [Select..Case] statement is what you seek. Though if all that changes based on the directory is the background URL, you could probably simplify your code a bit:
==========================
<% Select Case True
Case (Instr(directory, "/images/") > 0)
sCssBackgroundUrl = "navbar.gif"
Case (Instr(directory, "/directory2/") > 0)
sCssBackgroundUrl = "directory2navbar.gif"
Case (Instr(directory, "/directory3/") > 0)
'// Default case, if all previous cases are not met.
sCssBackgroundUrl = "other_navbar.gif"
End Select %>
<td valign="top" colspan="2" style="background:url(<%=s
...
</td>
==========================
-= DeathToSpam =-
Business Accounts
Answer for Membership
by: angelIIIPosted on 2007-11-12 at 13:31:29ID: 20267547
use the SELECT CASE statement:
ar.gif);ba ckground-r epeat:no-r epeat;padd ing-left:1 2px;height :22px;padd ing-top:4p x;"> r_navbar.g if);backgr ound-repea t:no-repea t;padding- left:12px; height:22p x;padding- top:4px;"> d_navbar.g if);backgr ound-repea t:no-repea t;padding- left:12px; height:22p x;padding- top:4px;">
<% select case true
case Instr(directory, "/images/") > 0 Then
%><td valign="top" colspan="2" style="background:url(navb
<% case Instr(directory, "/other_folder/") > 0
%><td valign="top" colspan="2" style="background:url(othe
<% case else
%><td valign="top" colspan="2" style="background:url(hddv
<% end select%>