- From: Jens Brueckmann <lists@j-a-b.net>
- Date: Thu, 09 Dec 2004 17:31:44 +0100
- To: "www-validator@w3.org" <www-validator@w3.org>
On Thu, 09 Dec 2004 10:06:19 -0500, B.K. DeLong <bkdelong@pobox.com> wrote: > I've been wrestling with a JavaScript error from the validator for a few > days for the following code. > > document.write("<SCR" + "IPT Language = 'JavaScript' SRC = '" + wtl_loc > + "'></SCR" + "IPT>"); > > Thanks in advance for any suggestions. I'm wondering if I've just been > staring at the code for too long. The problem with this string is that it contains the end tag open delimiter sequence </ When using markup inside a script element you should always escape at least the solidus (slash): <\/ example 1: document.write("<SCR" + "IPT Language = 'JavaScript' SRC = '" + wtl_loc + "'><\/SCR" + "IPT>"); Another way of escaping which might be advisable depending on the script, is encoding the LESS-THAN SIGN < of the open tag as \u003C example 2: document.write("\u003CSCR" + "IPT Language = 'JavaScript' SRC = '" + wtl_loc + "'>\u003C/SCR" + "IPT>"); Information about this restriction can be found in the validator faq: http://validator.w3.org/docs/help.html#faq-javascript and in Appendix B of the HTML 4.01 Recommendation: http://www.w3.org/TR/html401/appendix/notes.html#h-B.3.2.1 Cheers, jens -- Jens Brueckmann http://www.j-a-b.net/
Received on Thursday, 9 December 2004 16:31:52 UTC