Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Thanked 77 Times in 77 Posts

    validator warning &&

    <img alt ="" src = '../img/g/image_knof.png' title = 'foo' onclick="imagePath = prompt('Enter Image URL:', 'http://'); if ((imagePath != null) && (imagePath != '')) {formatDoc('InsertImage',imagePath);}" />
    && seems to be a problem (first & marked red in validator)

    …, 'http://'); if ((imagePath != null) && (imagePath != '')) {formatDoc('Insert…

    This message may appear in several cases:

    You tried to include the "<" character in your page: you should escape it as "&lt;"
    You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&amp;", which is always safe.
    Another possibility is that you forgot to close quotes in a previous tag.

    Solution & explanation ?
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Sydney, Australia
    Thanked 681 Times in 670 Posts
    When you need to include < in your HTML you should write it as &lt; as < indicates the start of a tag.

    When you need to include a & in your HTML you should write it as &amp; as & indicates the start of an HTML entity code.

    Of course if you moved the JavaScript to a separate file where it belongs then it wouldn't be getting confused with HTML.
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts