W3C home > Mailing lists > Public > www-validator@w3.org > December 2008

RE: [VE][xmlwf] Anchor href problem

From: Jos Keuter \(Dynarics\) <jos.keuter@dynarics.com>
Date: Fri, 5 Dec 2008 16:46:49 +0100
To: <www-validator@w3.org>
Message-ID: <49394d14.1e35440a.6fec.ffffe432@mx.google.com>

Hi David,

Thanks for the quick response.

Your 'aside' remark helped me out actually (valid XHTML1.0 and valid CSS2.1
and still got everything working cross-browser). 
I totally agree that my way wasn't the best practise but I used the
javascript because I wanted to trigger related AJAX content here but I found
a better way for that also.

So thanks again for your input!

Cheers, 

Jos.


-----Original Message-----
From: David Dorward [mailto:dorward@gmail.com] On Behalf Of David Dorward
Sent: vrijdag 5 december 2008 12:20
To: Jos Keuter (Dynarics)
Cc: www-validator@w3.org
Subject: Re: [VE][xmlwf] Anchor href problem

Jos Keuter (Dynarics) wrote:
>
> Error [xmlwf]: " XML Parsing Error: xmlParseEntityRef: no name"
> NOTE: Whenever possible, give the address of the document you were 
> checking.  Sorry, running a local project here…
>
So we don't know what Doctype you are using, what Content-Type you are 
using, or what the rest of the document looks like.


> Hi,
>
> I get the error message above when validating a page.
>
> This is the code:
>
> <a href=”javascript:myNamespace.navigateTo('/Somewhere/Home/14/');”>…</a>
I don't see an ampersand there, which is the usual cause of the error. 
Is this the right piece of code?

As an aside...

Using href="javascript:..." is not good practice.

Something along the lines of:

<a href="/Somewhere/Home/14/" 
onclick="myNamespace.navigateTo(this.href); return false;"> would be better.

... and attaching the JS event programatically (e.g. jQuery('#myMenu 
a').click(function () { myNamespace.navigateTo(this.href); return false; 
} ) would be better separation of concerns.


(Please direct follow ups to www-validator and not directly to me, thanks)

-- 
David Dorward
Received on Friday, 5 December 2008 15:48:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:33 GMT