By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,382 Members | 1,637 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,382 IT Pros & Developers. It's quick & easy.

W3C validator doesn't like this line

P: n/a
Can anyone spot why the W3C validator dosen't like this line:

function onLine() {document.getElementById("SiteStatus").innerHTML = "<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


Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Wow thanks Jan that worked... but I don't understand why.

Help much appreciated.

Nick

"Jan Ehrhardt" <mo*****@monitor.nl.X> wrote in message
news:hu********************************@4ax.com...
NickC in comp.lang.javascript (Tue, 8 Jul 2003 16:19:04 +0000 (UTC)):
Can anyone spot why the W3C validator dosen't like this line:

function onLine() {document.getElementById("SiteStatus").innerHTML = "<AHREF='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?


Try <\/A> in stead of </A>.

Jan
--
Look, Ma. No tables - http://www.steenbergen-stichting.nl/enbio.html

Jul 20 '05 #2

P: n/a
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>Technically, 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:<script
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.
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.