Link, name, parameter and anchor

Discussion in 'HTML' started by Maxime, Mar 19, 2007.

  1. Maxime

    Maxime Guest

    Hello everybody !

    Here is my problem. I want to create a HTML link to another page, to a
    specified place in the target page. I do this using this code :
    source page : <a href="target_page.html#position>link</a>
    target page : <a name="position"></a>
    And it works, when clicking on "link" in the source page, the target page
    opens and the anchor "position" is placed on top of the page. Right.

    But now I have to do the same with a target page (in PHP) with a parameter.
    The target URL is then "target_page.php?parameter=xxx" but how do I specify
    the anchor ? Using <a href="target_page.php#position?parameter=xxx>link</a>
    doesn't work.

    I tried using the "name" tag as this :
    source page : <a href="target_page.html" name="position">link</a>
    target page : <a name="position"></a>
    But it doesn't work, the target page opens but stays in top of the page...
    Is it possible to use the "name" tag when adressing to another page ? If
    yes, why does my code doesn't work ?

    Do anyone has an idea to help me ?

    Thanks.
     
    Maxime, Mar 19, 2007
    #1
    1. Advertising

  2. Maxime

    Els Guest

    Maxime wrote:

    > But now I have to do the same with a target page (in PHP) with a parameter.
    > The target URL is then "target_page.php?parameter=xxx" but how do I specify
    > the anchor ? Using <a href="target_page.php#position?parameter=xxx>link</a>
    > doesn't work.


    Have you tried <a
    href="target_page.php?parameter=xxx#position>link</a> ?

    --
    Els http://locusmeus.com/
    accessible web design: http://locusoptimus.com/
     
    Els, Mar 19, 2007
    #2
    1. Advertising

  3. Maxime

    Maxime Guest

    "Els" <> a écrit dans le message de news:
    f7q05l1eaq3s$.kb36s03uhsu3$...
    > Maxime wrote:
    >
    >> But now I have to do the same with a target page (in PHP) with a
    >> parameter.
    >> The target URL is then "target_page.php?parameter=xxx" but how do I
    >> specify
    >> the anchor ? Using <a
    >> href="target_page.php#position?parameter=xxx>link</a>
    >> doesn't work.

    >
    > Have you tried <a
    > href="target_page.php?parameter=xxx#position>link</a> ?
    >
    > --
    > Els http://locusmeus.com/
    > accessible web design: http://locusoptimus.com/


    Yes of course but it doesn't work neither, it thinks that the value of the
    parameter is "xxx#position" !
     
    Maxime, Mar 19, 2007
    #3
  4. Maxime wrote:
    >
    > "Els" <> a écrit dans le message de news:
    > f7q05l1eaq3s$.kb36s03uhsu3$...
    >> Maxime wrote:
    >>
    >>> But now I have to do the same with a target page (in PHP) with a
    >>> parameter.
    >>> The target URL is then "target_page.php?parameter=xxx" but how do I
    >>> specify
    >>> the anchor ? Using <a
    >>> href="target_page.php#position?parameter=xxx>link</a>
    >>> doesn't work.

    >>
    >> Have you tried <a
    >> href="target_page.php?parameter=xxx#position>link</a> ?


    > Yes of course but it doesn't work neither, it thinks that the value of the
    > parameter is "xxx#position" !
    >


    Works for me:

    http://www.littleworksstudio.com/gallery.php?sr=20&gid=D1#BMcres0047
    Objets D'Art Online Gallery of Little Works Studio

    BTW You do not have to use the old named A element to create an anchor.
    Just set any element's ID

    <p id="position">Lorem ipsum dolor sit amet, consectetuer...

    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
     
    Jonathan N. Little, Mar 19, 2007
    #4
  5. Els wrote:
    > Maxime wrote:
    >
    >> Using <a href="target_page.php#position?parameter=xxx>link</a>
    >> doesn't work.

    >
    > Have you tried <a
    > href="target_page.php?parameter=xxx#position>link</a> ?


    I can hear Maxime's loud "D'oh!" from here!

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

    * = I'm getting there!
     
    Toby A Inkster, Mar 19, 2007
    #5
  6. Maxime wrote :
    > Hello everybody !
    >
    > Here is my problem. I want to create a HTML link to another page, to a
    > specified place in the target page. I do this using this code :
    > source page : <a href="target_page.html#position>link</a>
    > target page : <a name="position"></a>


    This is called an empty anchor. It is always better and it is
    recommended to avoid empty anchors.

    E.g.: a good recommended way to create an anchor:

    <h2><a name="section2">Section 2: How to create a link</a></h2>

    > And it works, when clicking on "link" in the source page, the target
    > page opens and the anchor "position" is placed on top of the page. Right.
    >


    This may be a normal fallback mechanism for a failure to reach the
    targeted anchor and not a successful loading of the anchored position of
    the page. If the anchor #position does not exist, then most/all browsers
    will load the page at the top of the page anyway.

    > But now I have to do the same with a target page (in PHP) with a
    > parameter. The target URL is then "target_page.php?parameter=xxx" but
    > how do I specify the anchor ? Using <a
    > href="target_page.php#position?parameter=xxx>link</a> doesn't work.
    >
    > I tried using the "name" tag as this :
    > source page : <a href="target_page.html" name="position">link</a>
    > target page : <a name="position"></a>
    > But it doesn't work, the target page opens but stays in top of the page...
    > Is it possible to use the "name" tag when adressing to another page ? If
    > yes, why does my code doesn't work ?
    >
    > Do anyone has an idea to help me ?


    Nvu User Guide
    3.7.1.3 Inserting named Anchors
    3.7.1.4 Linking to named anchors
    http://www.nvudev.org/guide/html/ugs03.htm#s3713

    HTML Dog on links
    http://www.htmldog.com/guides/htmlbeginner/links/

    Web Authoring FAQ: hyperlinks (QDG)
    6.2. How do I link to a location in the middle of an HTML document?
    http://www.htmlhelp.com/faq/html/links.html#named-anchor

    Gérard
    --
    Using Web Standards in your Web Pages (Updated Dec. 2006)
    http://developer.mozilla.org/en/docs/Using_Web_Standards_in_your_Web_Pages
     
    =?ISO-8859-15?Q?G=E9rard_Talbot?=, Mar 20, 2007
    #6
  7. Maxime

    Maxime Guest

    "Toby A Inkster" <> a écrit dans le message de
    news: 5n.co.uk...
    > Els wrote:
    >> Maxime wrote:
    >>
    >>> Using <a href="target_page.php#position?parameter=xxx>link</a>
    >>> doesn't work.

    >>
    >> Have you tried <a
    >> href="target_page.php?parameter=xxx#position>link</a> ?

    >
    > I can hear Maxime's loud "D'oh!" from here!
    >
    > --
    > Toby A Inkster BSc (Hons) ARCS
    > Contact Me ~ http://tobyinkster.co.uk/contact
    > Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux
    >
    > * = I'm getting there!


    D'oh !!!
    In fact in the target page I wrote <name=position></a> instead of <a
    name=position></a> !!!!
    Stupid error...but sometimes easy bugs are difficult to find !!!
    Now it works fine.
    Thanks for your responses.

    Maxime.
     
    Maxime, Mar 20, 2007
    #7
  8. Scripsit Maxime:

    > In fact in the target page I wrote <name=position></a> instead of <a
    > name=position></a> !!!!
    > Stupid error...but sometimes easy bugs are difficult to find !!!


    This one wouldn't have been very difficult if you had used a validator. Not
    all mistakes in markup are reportable by a validator, but a mistake like
    this is.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Mar 20, 2007
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    949
    Kevin Spencer
    May 17, 2005
  2. Tristan Miller

    lang parameter in anchor tag

    Tristan Miller, Sep 26, 2003, in forum: HTML
    Replies:
    11
    Views:
    1,168
    Tristan Miller
    Sep 29, 2003
  3. David C
    Replies:
    2
    Views:
    827
    Damon B.
    Aug 31, 2008
  4. Tim W

    Link and Anchor

    Tim W, Feb 14, 2012, in forum: HTML
    Replies:
    12
    Views:
    1,784
    Jonathan N. Little
    Feb 24, 2012
  5. Ton den Hartog

    Link and Anchor, what is the difference ???

    Ton den Hartog, Jan 12, 2004, in forum: Javascript
    Replies:
    2
    Views:
    219
    Ton den Hartog
    Jan 12, 2004
Loading...

Share This Page