[VE][64] Validator parses <.....> inside <script></script> need advise

Hi all,

I have without luck many a' times tried to resolve this problem with a little 
javascript snippet to add a page to bookmarks/favorites, I need some advise, the 
best answer for me is ofcourse the solution since I have already read tons of 
pages including http://www.w3.org/TR/xhtml1/#h-4.8 without being able to find a 
workable solution

The script is located at http://luvaduck.homelinux.org
Validating 
http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fluvaduck.homelinux.org
>
>    1. Error /Line 46 column 170/: document type does not allow element "a" here.
>       |...g]','http://luvaduck.homelinux.org')"*>*<span class='xscb'>Never forget this si|
>
>       The element named above was found in a context where it is not allowed.
>       This could mean that you have incorrectly nested elements -- such as a
>       "style" element in the "body" section instead of inside "head" -- or two
>       elements that overlap (which is not allowed).
>
>       One common cause for this error is the use of XHTML syntax in HTML
>       documents. Due to HTML's rules of implicitly closed elements, this error
>       can create cascading effects. For instance, using XHTML's "self-closing"
>       tags for "meta" and "link" in the "head" section of a HTML document may
>       cause the parser to infer the end of the "head" section and the
>       beginning of the "body" section (where "link" and "meta" are not
>       allowed; hence the reported error).
>
>      
>       <http://validator.w3.org/feedback.html?uri=http%3A%2F%2Fluvaduck.homelinux.org%2Findex.php%3Fp%3Dwebcam;errmsg_id=64#errormsg>
>
>


The javascript: which is from dynamicdrive looks like this (slightly modified to 
be xHTML, yet still getting that error)

<head>
function bookmarksite(title, url){
 if (document.all)
  window.external.AddFavorite(url, title);
 else if (window.sidebar)
  window.sidebar.addPanel(title, url, "")
}
</head>

<body>
   <script type="text/javascript">document.write(<a class='allw' 
href="javascript:bookmarksite('Jesper\'s Site 
[luvaduck.homelinux.org]','http://luvaduck.homelinux.org')"><span 
class='xscb'>Never forget this site, Bookmark it now !</span></a>);</script>

   <noscript><p class="xsyc">Javascript is disabled in your browser, Press 
CTRL+D to bookmark this site now!</p></noscript>
</body>

If the site isnt up when you read this, then I am in windows (dual booting 
between Linux and Windows (Windows for gaming)) then I am using the same script 
here: http://jesper.tidesofwar.net/

I am looking forward to some serious replies, so thanks in advance.

Kind regards
Jesper

Received on Wednesday, 17 January 2007 15:10:37 UTC