Help with IF ELSE

J

Jules

Just trying to display different wording depending on reference put in.
Got it to work ok when it was just ABC then 123, otherwise 789, but now
have to add a second IF and am getting errors. Could someone advise
where I'm going wrong please?

If its ABC or DEF then put 123
If its GHI or JKL then put 456
otherwise put 789


<%If UCase(Left(msHeader,3)) = "ABC" or UCase(Left(msHeader,3)) =
"DEF" Then %>
<i> 123 </i>
<% Else %>
<% if UCase(Left(msHeader,3)) = "GHI" or UCase(Left(msHeader,3)) =
"JKL" Then %>
<i> 456 </i>
<% Else %>
<i> 789 </i>
<% End If %>
 
V

VK

Jules said:
Just trying to display different wording depending on reference put in.
Got it to work ok when it was just ABC then 123, otherwise 789, but now
have to add a second IF and am getting errors. Could someone advise
where I'm going wrong please?

If its ABC or DEF then put 123
If its GHI or JKL then put 456
otherwise put 789


<%If UCase(Left(msHeader,3)) = "ABC" or UCase(Left(msHeader,3)) =
"DEF" Then %>
<i> 123 </i>
<% Else %>
<% if UCase(Left(msHeader,3)) = "GHI" or UCase(Left(msHeader,3)) =
"JKL" Then %>
<i> 456 </i>
<% Else %>
<i> 789 </i>
<% End If %>

Wrong newsgroup. Ask at <microsoft.public.scripting.vbscript>
 
E

Evertjan.

VK wrote on 20 mrt 2006 in comp.lang.javascript:
Wrong newsgroup. Ask at <microsoft.public.scripting.vbscript>

better? : <microsoft.public.inetserver.asp.general>

btw, you should use "elseif" [or "case"]

<i><%

temp = UCase(Left(msHeader,3))
If temp = "ABC" or temp = "DEF" Then

%>123<%

Elseif temp = "GHI" or temp = "JKL" Then

%>456<%

Else

%>789<%

End If

%></i>
 

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,772
Messages
2,569,593
Members
45,108
Latest member
AlbertEste
Top