Click here to get back home

FF: anchor links not working..

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
FF: anchor links not working.. Frances 02-08-2006
Posted by Frances on February 8, 2006, 10:52 am
Please log in for more thread options



<a href="#1">

<a name="#1">

this link is not working in FF (works fine in IE..)
would appreciate thoughts/suggestions.. thank you..

Frances

Posted by Steve Pugh on February 8, 2006, 11:13 am
Please log in for more thread options


Frances wrote:
> <a href="#1">
>
> <a name="#1">
>
> this link is not working in FF (works fine in IE..)
> would appreciate thoughts/suggestions.. thank you..

IE is fixing your error for you. Firefox is not.

It should be <a name="1">.

Or use an id on any element instead and get rid of the targetted <a>
element altogether. But be aware that id values must start with a
letter not a digit.

Steve


Posted by Alan J. Flavell on February 8, 2006, 11:14 am
Please log in for more thread options


On Wed, 8 Feb 2006, Frances wrote:

>
> <a href="#1">
>
> <a name="#1">
>
> this link is not working in FF

No, its name isn't "#1". There's two things wrong with that, so
Mozilla/FF are working correctly in refusing to use it.

> (works fine in IE..)

No it doesn't. It might do what you wanted it to do, but (as so often
with IE) that only demonstrates that it's broken.

> would appreciate thoughts/suggestions..

http://www.w3.org/TR/REC-html40/types.html#type-name

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
followed by any number of letters, digits ([0-9]), hyphens ("-"),
underscores ("_"), colons (":"), and periods (".").

Use something like <a href="#n1">

Then use id="n1" on a suitable element for current browsers.

Your <a name="n1"> is for ancient browsers; but if you do that, and if
you use a style for a:hover , you're due for some surprises in a
conforming browser. (IE, <=6, as usual gets this wrong. I don't
know about 7 yet, and I'm not sure I can really be bothered, having
seen how many bugs are still being reported with it).


Posted by Steve Pugh on February 8, 2006, 12:34 pm
Please log in for more thread options


Alan J. Flavell wrote:
> http://www.w3.org/TR/REC-html40/types.html#type-name
>
> ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
> followed by any number of letters, digits ([0-9]), hyphens ("-"),
> underscores ("_"), colons (":"), and periods (".").

Strange as it may seem, the name attribute of the <a> element is not a
NAME token as far as I can tell.

Steve


Posted by Alan J. Flavell on February 8, 2006, 2:12 pm
Please log in for more thread options


On Wed, 8 Feb 2006, Steve Pugh wrote:

> Alan J. Flavell wrote:
> > http://www.w3.org/TR/REC-html40/types.html#type-name
> >
> > ID and NAME tokens must begin with a letter ([A-Za-z]) and may be
> > followed by any number of letters, digits ([0-9]), hyphens ("-"),
> > underscores ("_"), colons (":"), and periods (".").
>
> Strange as it may seem, the name attribute of the <a> element is not a
> NAME token as far as I can tell.

That's rather a mess, isn't it? The "a name=" attribute takes a value
of type CDATA, which suggests it could be pretty much anything. But
it links to a piece of text which says

Name = cdata [...]
Note that this attribute shares the same name space as the id
attribute.

Which can weasily[1] be interpreted as "same syntax rules apply for
both", although you might want to argue that it doesn't say that in so
many words.

The id attribute takes a value of type "id", which indeed is
constrained as described.

If the name= attribute had been defined to take a value of "id", then
it would not have been possible to use the same value in an id= (for
current browsers) and <a name="..."> (for old browsers). Obviously
they needed to avoid that clash somehow, if they were to keep this
compatibility feature.

Or you could just argue that they kept CDATA here because that was
what was in HMTL/3.2(spit!). Ho hum.

So, using name="1" would not raise a validation error, but id="1"
surely would (and indeed it does). In fact, even name="#1" (which was
wrong for a different reason) would not raise a validation error - but
it's surely wrong, nevertheless.

--
[1]
Q: Can you tell the difference between a polecat and a ferret?
A: Oh yes, weasily.
SCNR.

Similar ThreadsPosted
CSS styles not working for anchor tags. August 13, 2005, 4:03 pm
Problem with Anchor link now working properly in IE! February 1, 2005, 12:33 pm
url masking stops links working? January 25, 2005, 1:23 pm
Menu links in frame not working after I link to external site using IE January 18, 2008, 7:18 pm
Hiding an anchor tag September 1, 2006, 1:31 am
Anchor tags IE 7 February 25, 2007, 8:23 pm
In page anchor problem July 19, 2004, 8:00 am
Why does named anchor fail? August 8, 2006, 8:44 pm
Anchor with TYPE attribute August 25, 2008, 10:39 am
html anchor tag displayed in middle not top October 11, 2005, 8:30 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap