PDA

View Full Version : Problem when linking to an anchor


paid2review
03-21-2007, 05:43 PM
Hi there,

I've got a strange problem with one of the pages on my website...

I've got a link to an anchor and when I click the link it cuts straight to the anchor but it messes up the top half of the website, and you can't scroll back up to the top.
Its hard to explain without showing you the page itself. If you click on the article title you can see what I mean...

http://www.paid2review.co.uk/moneyarticles.html

I'm not sure if it must be an error with my CSS? Or something causing the anchored link to behave weird?


Thanks for any help.
Matt

karinne
03-21-2007, 05:47 PM
What do we click on to get this behavior?

paid2review
03-21-2007, 06:23 PM
Underneath "Articles submitted so far" click on either of the 2 article links...


Thanks

ahallicks
03-21-2007, 06:33 PM
Close the <a name> tag immediately after it! I.E don't put any text in. Never seen this before but it's weird because it also breaks the back button so you can't go back to the original page!

karinne
03-21-2007, 06:34 PM
Wow ... that is weird. Try using <a id=""> instead of <a name="">

also ... why do you have an XHTML 1.1 DOCTYPE when you are serving the site as HTML? stick to XHTML Transitional or HTML Strict. That might solve you're problem also ...

Not many browsers are ready to display sites as XML so ... it's rather pointless. Since you need the XML prolog too and IE can't handly it at the moment.

paid2review
03-21-2007, 06:44 PM
Close the <a name> tag immediately after it! I.E don't put any text in. Never seen this before but it's weird because it also breaks the back button so you can't go back to the original page!

I've tried closing it straight after and it does the same, still acts weirdly.

Also, not sure if this is related to what karinne said in the last post, but when trying to validate the page I get an error:

Line 125 column 14: there is no attribute "name".
<p><b><a name="earn-money-from-betting"></a>Earn from "Matched Betting"</b>&nbsp


Why would this be?

Thanks for the help

Pennimus
03-21-2007, 06:55 PM
It is related - the name attribute is not supported by XHTML. You should use id= instead, or not use XHTML as a doctype.

karinne
03-21-2007, 07:05 PM
Yep ... that's why I said to use the id instead of name ;)

paid2review
03-21-2007, 10:15 PM
Right, thanks for that.

I've changed it to id instead of name, there are no errors in the validation but the problem is still there - when I click the link it takes me to the anchor but messes up the rest of the page :confused:


Thanks for any help offered.

paid2review
03-21-2007, 11:18 PM
Fixed it now, played around with the CSS file. Thanks for all the help :thumbsup:


Matt

jlhaslip
03-21-2007, 11:26 PM
and the cure was??? what ??? exactly???