Linking to an #ID on a different page.

Discussion in 'Web Design and Development' started by Greenhoe, Feb 9, 2009.

  1. Greenhoe macrumors regular

    Joined:
    Dec 17, 2008
    #1
    Hi,
    I wanted to know if it is possible to link to a specific #ID that is on another page.

    Such as...
    Link from page 1, to an ID on page 2.

    If this is possible how do I make the link? Thanks

    Thanks
     
  2. r.j.s Moderator emeritus

    r.j.s

    Joined:
    Mar 7, 2007
    Location:
    Texas
    #2
    I think you have to give it an anchor, not an id.
     
  3. Greenhoe thread starter macrumors regular

    Joined:
    Dec 17, 2008
    #3
    How exactly do I do that? I'm not familiar with anchors at all. Is it similar to an ID? As I have a ID in a DIV on another page which I'm trying to link to.
     
  4. r.j.s Moderator emeritus

    r.j.s

    Joined:
    Mar 7, 2007
    Location:
    Texas
    #4
    Use <a name="div1"></a> right before the div you want to link to.

    Then for the link use: <a href="page.htm#div1">Link</a>

    Replace div1 with whatever name you want.
     
  5. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #5
    The id attribute will generally work as well. There might be some old browsers that don't understand it, but can't remember specifics.

    page.html:
    HTML:
    <a href="somepage.html#idName">Link to id on some other page</a>
    somepage.html:
    HTML:
    <div id="idName">
     

Share This Page