简体   繁体   中英

javascript syntax error explaination

Help. I'm uncertain about about this error. It looks correct and the session attribute is not null. I am getting a token error on the following:

Syntax error on token "<", delete this token a cannot be resolved to a type Syntax error, insert ";" to complete BlockStatements style cannot be resolved to a variabl

    <%if (session.getAttribute("home").toString().equals("canada")) {
        <a href="homecanada.jsp" style="font-size:3px;">
            <img src="images/image.jpg" width="232" height="71" alt="alt text" class="logo"  />
        </a>
    <%}else{%>}
        <a href="homeusa.jsp" style="font-size:3px;">
            <img src="images/image.jpg" width="232" height="71" alt="alt text" class="logo"  />
        </a>
    <%}%>

If looks like you have an extra bracket and a close tag:

   <%if (session.getAttribute("home").toString().equals("canada")) {%>
        <a href="homecanada.jsp" style="font-size:3px;">
            <img src="images/image.jpg" width="232" height="71" alt="alt text" class="logo"  />
        </a>
    <%}else{%>
        <a href="homeusa.jsp" style="font-size:3px;">
            <img src="images/image.jpg" width="232" height="71" alt="alt text" class="logo"  />
        </a>
    <%}%>

There... That's what it looks like with the bracket removed (after the else), and the first line close tag.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM