-2

I am a beginner HTML and I am having trouble putting my idea into the right syntax. I have the following HTML snippet:

<div id="footerterms"><span class="mainsmaller"><a href="/privacy.jsp">Privacy</a> | <a href="/terms_of_use.pdf">Terms of Use</a> | <a href="/sitemap.jsp">Site Map</a></span></div>

What I am trying to do is to have them open in a new tab whenever the user is on a specific page. I figured that having a boolean is a fair way to do it. I wrote the code below, but it seems that the syntax is off.

<var showIt=true;>
<% showIt = Request.ServerVariables("URL") == "payment.jsp" %>
    <% if(showIt){ %>
        <div id="footerterms"><span class="mainsmaller"><a href="/privacy.jsp" target="_blank" >Privacy</a> | <a href="/terms_of_use.pdf" target="_blank" >Terms of Use</a> | <a href="/sitemap.jsp" target="_blank" >Site Map</a></span></div>
    <% }else{ %>    
        <div id="footerterms"><span class="mainsmaller"><a href="/privacy.jsp">Privacy</a> | <a href="/terms_of_use.pdf">Terms of Use</a> | <a href="/sitemap.jsp">Site Map</a></span></div>
    <% } %>
A.J
  • 1,140
  • 5
  • 23
  • 58

1 Answers1

1

You should also wrap '}' in an ASP block and declare the variable properly. About the URL check, you can read this other answer.

<% showIt = Request.ServerVariables("URL") == "theUrlToCheck" %>
<% if(showIt){ %>
    <div ...>...</div>
<% }else{ %>    
    <div ...>...</div>
<% } %>
GMunguia
  • 81
  • 4
  • I edited my question with your suggestion. It looks like it is still crashing when I run it. – A.J Oct 04 '16 at 20:17