SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: issues

  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2010
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    issues

    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!

    Thanks!

  2. #2
    Life is not a malfunction gold trophysilver trophybronze trophy
    TechnoBear's Avatar
    Join Date
    Jun 2011
    Location
    Argyll, Scotland
    Posts
    6,088
    Mentioned
    255 Post(s)
    Tagged
    5 Thread(s)
    I'm not sure I've understood your problem, so apologies if this isn't what you were looking for.

    If your link reads
    Code:
    <a href="#pricing">Pricing</a>
    then you should have a corresponding id to link it to:
    Code:
    <a id="pricing">Pricing info</a>

  3. #3
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    NOT that one should be using an anchor for that anymore. The format for doing it with an anchor:

    <a name="pricing"></a>

    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>

    ... doing:

    <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"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •