i <= 3 w3 validator not accepting.

Discussion in 'JavaScript' started by xamd404, May 1, 2011.

  1. #1
    Hello,

    I'm struggling to get some javascript validated with the w3 validator. It gives me this error:

    for (i=1; i <=3; i++)

    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.


    any ideas on how to overcome this? This is the only error it is displaying.
     
    xamd404, May 1, 2011 IP
  2. Jan Novak

    Jan Novak Peon

    Messages:
    121
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    0
    #2
    put your JS into cdata section if you use xhtml:

    
    <script type="text/javascript">
    /* <![CDATA[ */
    
    // content of your Javascript goes here
    
    /* ]]> */
    </script> 
    
    Code (markup):
     
    Jan Novak, May 1, 2011 IP
  3. xamd404

    xamd404 Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks a lot

    +rep
     
    xamd404, May 1, 2011 IP