XHTML Validation Problem

Discussion in 'HTML & Website Design' started by Guardian, Jan 7, 2013.

  1. #1
    Here is the code.

    function increase_height() {
       height = parseInt(document.getElementById('slide').style.marginTop);
       if (height<110) {
          document.getElementById('slide').style.marginTop = eval(height+2)+"px";
          setTimeout("increase_height()",0.0001);
       } else {
          document.getElementById('panel').style.zIndex = 200;
       }
    }
    Code (markup):
    According to W3 validator this part of the code is wrong

    (height[COLOR="#FF0000"]<[/COLOR]110)
    Code (markup):
    Line 26, Column 14: character "<" is the first character of a delimiter but occurred as data
    if (height<110) {


    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.
    Line 26, Column 14: StartTag: invalid element name
    if (height<110) {


    Is there a better way to code this part?
     
    Guardian, Jan 7, 2013 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    try
    
    <script type="text/javascript">
    //<![CDATA[
    ...your code here...
    //]]>
    </script>
    Code (markup):
     
    Rukbat, Jan 7, 2013 IP
  3. Guardian

    Guardian Active Member

    Messages:
    922
    Likes Received:
    77
    Best Answers:
    0
    Trophy Points:
    80
    #3
    This is what I was missing. Thanks so much for the help.

    //<![CDATA[
    ...your code here...
    //]]>
    Code (markup):
     
    Guardian, Jan 7, 2013 IP