Forum Moderators: not2easy

Message Too Old, No Replies

Anchor links don't work in IE6

         

averagejoe

4:01 pm on Aug 12, 2003 (gmt 0)

10+ Year Member



Has anyone else experienced this?

I've coded a site that is HTML 4.01 Transitional, and everything is fine with one maddening exception. My "top of page" link doesn't work in IE6. It's just an anchor link, and it works fine in Mozilla, but not IE6.

Here's the weird part - if I take out the DOCTYPE, it works fine. Put it back in, it breaks.

Anyone have any experience with this?

drbrain

4:15 pm on Aug 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you validate your HTML at [validator.w3.org...]

averagejoe

5:09 pm on Aug 12, 2003 (gmt 0)

10+ Year Member



Yes, and my pages validate. The only exception is when an illegal character sneaks its way in from the content database. Everything else validates.

SuzyUK

5:31 pm on Aug 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



have you actually set an id (name) ="top" anywhere on your page?

I think most browsers recognise that <a href="#top"> should take you to the top of the page without setting a bookmark, so might IE unless it's in quirks mode.. which would explain why it works when you remove the DTD.

try <body id="top"> or if you've a header at the top of each page add id="top" to it..

Suzy

averagejoe

6:25 pm on Aug 12, 2003 (gmt 0)

10+ Year Member



I do have an anchor at the top of the page:

<a name="pagetop"></a>

I realize there are differences with id vs. name, but I've tried it both ways with no luck. Mozilla doesn't seem to care either way.

SuzyUK

8:42 pm on Aug 13, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



so if you've set the bookmark "pagetop" are your anchors(links) then saying <a href="#pagetop">to top of page</a>

any unrecognized "#" will take you to the top of page, like Moz does, by default so it would be better if you set them to the name "top" as this should cover all bases..

Suzy

averagejoe

8:58 pm on Aug 13, 2003 (gmt 0)

10+ Year Member



Yes, I've done that, too...

I get the feeling this would be easier if I provided a link... :}

[removed]

Thanks in advance for your help.

[edited by: averagejoe at 10:41 pm (utc) on Aug. 13, 2003]

hafnius

10:24 pm on Aug 13, 2003 (gmt 0)

10+ Year Member



Hi averagejoe

Ive looked at your page, BTW it is not allowed to post personal URL's, and i have some suggestions.

your anchor looks like this:

<a name="pagetop"></a>
<div id="masthead"><h1><a href="/collegian"><span>The Collegian</span></a></h1></div>

try it like this instead:


<div id="masthead"><h1 id="pagetop"><a href="/collegian"><span>The Collegian</span></a></h1></div>

Remove the named anchor and substitute it with the <h1> with an id of pagetop. That should work in both ie and moz.

On a smaller note you have an ID and a CLASS with the same name "pagetop". although this is perfectly legal it could potentially lead to problems.

Hope this helps

Kind regards
Hafnius

averagejoe

10:46 pm on Aug 13, 2003 (gmt 0)

10+ Year Member



AHA! =)

Thanks, hafnius! That did the trick. I cleaned up the class and id conflict as well.

Sorry about posting a personal URL - I wasn't aware of that rule. I've removed that link...

Thanks to everyone for their time!