PDA

View Full Version : Link not working in Mozilla/NetScape


gardensafari
10-25-04, 10:41 AM
Dear Members,

I have a problem in NetScape (version 7.2) and Mozilla (version 1.7.1). On top of each page is an anchor like this:

<a name="top"></a>

At regular intervals on each page there is a line. Clicking on this line brings one back to the top of the page where the navigation is. Like this:

<p><a href="#top" class="lijn"></a></p>

The CSS belonging to this link looks like this:

a.lijn{
background:url('../nav/lijn.jpg') no-repeat;
border 0px;
width: 800px;
height: 7px;
}

This works fine in both IE and Opera. But the line does not appear in NetScape or Mozilla and consequently neither does the link.

Does anyone know why this doesn't work in NetScape/Mozilla? Is there anything I can do to make it work?

An example of what I mean is here:
http://www.gardensafari.net/english/admirals.htm

RocketJeff
10-25-04, 11:01 AM
Dear Members,

I have a problem in NetScape (version 7.2) and Mozilla (version 1.7.1). On top of each page is an anchor like this:

<a name="top"></a>


Try either adding an id="top" to the tag, like:<a name="top" id="top"></a>

I believe that (depending on the version of html that you're specifying) that the id= attribute is now 'more correct' then the name= attribute for creating anchor links.

The html4 standard on this is at http://www.w3.org/TR/REC-html40/struct/links.html#anchors

rainbore
10-25-04, 11:12 AM
The problem is that there is no content between the <a href="#top"> and the </a> for Netscape to render in order to give it a background image. It might help to use a full <!DOCTYPE>, but I doubt it.

I would suggest that you make this a more conventional link around the image, as in

<p align="center"><a href="#top"><img src="../nav/lijn.jpg" border="0" alt="bar graphic" title="Top of Page Link"></a></p>


Better still, I'd recommend that you use a conventional text link so that users will have a chance to know that you're providing these links. As it stands, even if a user is using Internet Explorer, unless he happens to mouse over the graphic while watching the status bar, he'll never know this link exists. Good luck!

gardensafari
10-25-04, 11:47 AM
I followed your suggestion, but it doesn't work. You put me on the right track anyway, referring me to the official W3 documentation. Please see my answer to Rainbore's reply. But thanks a lot for your reaction anyway.

gardensafari
10-25-04, 11:59 AM
I did a search in the official W3 documentation. As it turns out you were quite right. Here's a quote:

"Note. User agents should be able to find anchors created by empty A elements, but some fail to do so. For example, some user agents may not find the "empty-anchor" in the following HTML fragment:

<A name="empty-anchor"></A>
<EM>...some HTML...</EM>
<A href="#empty-anchor">Link to empty anchor</A>"

This shows that with W3 allowing empty anchors, this is a bug in NetScape/Mozilla. Actually I am glad to see one, after all we thought only MS had them :D

You are right about the navigational line being quite unobtrusive. That's exactly why I changed it to CSS. This allows me to change all 1,600 or so lines at once, including dimensions etc. So I am not very keen on going back to specifying each and every line separately. Especially when lines get longer the search and replace in Note Tab, which I use, will stumble upon line breaks at the oddest of places. And these line breaks spoil the game, if you know what I mean. Having almost 800 pages it is simply too much work doing it all by hand. Probably overlooking some on the way.

Maybe I shouldn't care too much about it. The bug is in NetScape and probably they'll resolve it. Or am I being a bit optimistic here?

Thanks anyway for your answer. At least I know now where the problem is and how to solve it theoretically.

Cheers,

Hans

B&T
10-25-04, 01:30 PM
If you want an empty anchor, use a clear .gif file 1px by 1px and put it there.

gardensafari
10-25-04, 01:53 PM
Dear B&T

Tried that in the <a name="top"></a> part, doesn't work. There is no line displayed in NetScape. So probably NetScape doesn't like:
<p><a href="#top" class="lijn"></a></p>
either?
But I can hardly put a dummy image in there, could I. It would replace the standard image defined in class lijn....

Thanks for helping though. I thought I understood why it went wrong, but I am not that sure anymore. :o

(jj)
10-25-04, 02:32 PM
transparent.gif = 1px by 1px transparent gif (invisible)

<p><a href="#top" class="lijn"><img src="transparent.gif"></a></p>

YvetteKuhns
10-25-04, 02:34 PM
I just found this post and I had a similar problem with the empty anchor. A space would be ignored and you should not have to use an empty image, but you can use the code for the space <a name="top">&nbsp;</a> and this should work.

B&T
10-25-04, 02:41 PM
I just found this post and I had a similar problem with the empty anchor. A space would be ignored and you should not have to use an empty image, but you can use the code for the space <a name="top">&nbsp;</a> and this should work.
An even better idea :)

YvetteKuhns
10-25-04, 02:46 PM
Yeah. Why create empty gifs when you don't need to do so? It is just another file to worry about. ;)