W3C validator doesn't like this line

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NickC

    W3C validator doesn't like this line

    Can anyone spot why the W3C validator dosen't like this line:

    function onLine() {document.getEl ementById("Site Status").innerH TML = "<A
    HREF='http://AssocData.co.uk/StatusImg.gif'> Online</A>.";}

    It returns the error:

    1.. Line 21, column 126: end tag for element "A" which is not open
    (explain...).
    ...ocData.co.uk/StatusImg.gif'> Online</A>.";}
    ^
    but I cannot see why or how to stop it, any ideas?

    Thanks,
    Nick






  • NickC

    #2
    Re: W3C validator doesn't like this line

    Wow thanks Jan that worked... but I don't understand why.

    Help much appreciated.

    Nick

    "Jan Ehrhardt" <monitor@monito r.nl.X> wrote in message
    news:hurlgvoaua imn416s9q7gntgc 4jr1st78m@4ax.c om...[color=blue]
    > NickC in comp.lang.javas cript (Tue, 8 Jul 2003 16:19:04 +0000 (UTC)):
    >[color=green]
    > >Can anyone spot why the W3C validator dosen't like this line:
    > >
    > > function onLine() {document.getEl ementById("Site Status").innerH TML =[/color][/color]
    "<A[color=blue][color=green]
    > >HREF='http://AssocData.co.uk/StatusImg.gif'> Online</A>.";}
    > >
    > >It returns the error:
    > >
    > > 1.. Line 21, column 126: end tag for element "A" which is not open
    > >(explain...) .
    > > ...ocData.co.uk/StatusImg.gif'> Online</A>.";}
    > > ^
    > >but I cannot see why or how to stop it, any ideas?[/color]
    >
    > Try <\/A> in stead of </A>.
    >
    > Jan
    > --
    > Look, Ma. No tables - http://www.steenbergen-stichting.nl/enbio.html[/color]


    Comment

    • cwdjr

      #3
      Re: W3C validator doesn't like this line

      Re: Why the backslash is required. Below is what the W3C has to say on
      this subject. You can reach this and more from their validator site.
      Not everyone always agrees with the W3C, but at least you have their
      statement given below._________ _______________ _______________ _____Writing
      HTML in a SCRIPT ElementA common error (and the most common source of
      erroneous bug reports for the WDG HTML Validator) occurs when writing
      HTML tags within a SCRIPT element:<script type="text/javascript"> <!--
      // This is an error! document.write( "</P>"); // -->
      </script>Technica lly, the first occurrence of "</" followed by any
      letter is considered the end tag for the SCRIPT element. While
      browsers are forgiving in this, authors should avoid using strings
      such as "</P>" in their embedded scripts. JavaScript allows authors to
      use a backslash to avoid ending the SCRIPT element prematurely:<sc ript
      type="text/javascript"> <!-- document.write( "<\/P>"); // -->
      </script>________ _______________ _______________ __________I copied and
      pasted the above from the W3C site. Sometimes posting from Google
      messes up the code. If so, go to the W3C validator site to find a
      better copy. I use the Yahoo address to avoid spam being sent to my
      ISP e-mail.

      Comment

      Working...