Avatar of garethtnash
garethtnash
Flag for United Kingdom of Great Britain and Northern Ireland asked on

IF Statement wrong?

My HTML editor is telling me that this is the wrong way of doing this -

<%IF RsProductDetail.Fields.Item("Image2") <> "" then %><body onload="MM_preloadImages('<%=(RsProductDetail.Fields.Item("MainImage").Value)%>','<%=(RsProductDetail.Fields.Item("Image2").Value)%><%IF RsProductDetail.Fields.Item("Image3") <> "" then %>,'<%=(RsProductDetail.Fields.Item("Image3").Value)%><%End if%><%IF RsProductDetail.Fields.Item("Image4") <> "" then %>,'<%=(RsProductDetail.Fields.Item("Image4").Value)%><%End if%><%IF RsProductDetail.Fields.Item("Image5") <> "" then %>,'<%=(RsProductDetail.Fields.Item("Image5").Value)%><%End if%><%IF RsProductDetail.Fields.Item("Image6") <> "" then %>,'<%=(RsProductDetail.Fields.Item("Image6").Value)%>')"><%Else%><Body><%End if%>

Open in new window


It isn't however telling me how to correct the error.

Grateful for thoughts - thanks
VB ScriptASPHTML

Avatar of undefined
Last Comment
garethtnash

8/22/2022 - Mon
Sudaraka Wijesinghe

Looks like you are missing one EndIf:
<%IF RsProductDetail.Fields.Item("Image2") <> "" then %>
    <body onload="MM_preloadImages('<%=(RsProductDetail.Fields.Item("MainImage").Value)%>','<%=(RsProductDetail.Fields.Item("Image2").Value)%>
    <%IF RsProductDetail.Fields.Item("Image3") <> "" then %>
        ,'<%=(RsProductDetail.Fields.Item("Image3").Value)%>
    <%End if%>
    <%IF RsProductDetail.Fields.Item("Image4") <> "" then %>
        ,'<%=(RsProductDetail.Fields.Item("Image4").Value)%>
    <%End if%>
    <%IF RsProductDetail.Fields.Item("Image5") <> "" then %>
        ,'<%=(RsProductDetail.Fields.Item("Image5").Value)%>
    <%End if%>
    <%IF RsProductDetail.Fields.Item("Image6") <> "" then %>
        ,'<%=(RsProductDetail.Fields.Item("Image6").Value)%>')">
    <%Else%>
        <Body>
    <%End if%>

Open in new window

ASKER CERTIFIED SOLUTION
uvals

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
garethtnash

ASKER
Neat thank you
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck