zactive — 2012-03-01T10:25:53-05:00 — #1
I am trying to do a simple task and it is not working.
When someone clicks on a link it should drop them down or up to a certain part of the page. The code used:
Link = <a href="#pricing">Pricing</a>
Area = <a href="#pricing"></a>
Maybe im making an error since it's early in the morning?
Your help is appreciated!
technobear — 2012-03-01T12:18:45-05:00 — #2
I'm not sure I've understood your problem, so apologies if this isn't what you were looking for.
If your link reads
then you should have a corresponding id to link it to:
<a id="pricing">Pricing info</a>
system — 2012-03-03T19:04:03-05:00 — #3
NOT that one should be using an anchor for that anymore. The format for doing it with an anchor:
Is supposed to have been completely replaced by ID's... and you can put ID's on ANYTHING, not just anchors and still have it work...
so if say... "Pricing info" was a heading....
<h2 id="pricing">Pricing Info</h2>
<a href="#pricing">Go to Pricing</a>
... would work just fine. In any case, where you're messing up is trying to point at a href -- that's never going to work. href's point at URL's, and with a hash at 'name' or 'id'...
Which is why I would say find some element wrapping your pricing, and give it an ID to point at, instead of wasting time putting an empty anchor in there. Who knows, you might already have a perfectly good ID in place you could point at! It's why I have a number of 'standard ID's" I use on elements -- #mainMenu, #content, #footer -- that way on my accesskeys menu I can do href="#content" title="skip to content" accesskey="3"