Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Link, name, parameter and anchor

Reply
Thread Tools

Link, name, parameter and anchor

 
 
Maxime
Guest
Posts: n/a
 
      03-19-2007
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.

 
Reply With Quote
 
 
 
 
Els
Guest
Posts: n/a
 
      03-19-2007
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/
 
Reply With Quote
 
 
 
 
Maxime
Guest
Posts: n/a
 
      03-19-2007

"Els" <(E-Mail Removed)> a écrit dans le message de news:
f7q05l1eaq3s$.kb36s03uhsu3$(E-Mail Removed)...
> 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" !

 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      03-19-2007
Maxime wrote:
>
> "Els" <(E-Mail Removed)> a écrit dans le message de news:
> f7q05l1eaq3s$.kb36s03uhsu3$(E-Mail Removed)...
>> 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/gal...=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
 
Reply With Quote
 
Toby A Inkster
Guest
Posts: n/a
 
      03-19-2007
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!
 
Reply With Quote
 
=?ISO-8859-15?Q?G=E9rard_Talbot?=
Guest
Posts: n/a
 
      03-20-2007
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/lin...l#named-anchor

Grard
--
Using Web Standards in your Web Pages (Updated Dec. 2006)
http://developer.mozilla.org/en/docs...your_Web_Pages
 
Reply With Quote
 
Maxime
Guest
Posts: n/a
 
      03-20-2007

"Toby A Inkster" <(E-Mail Removed)> a écrit dans le message de
news: http://www.velocityreviews.com/forums/(E-Mail Removed)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.

 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      03-20-2007
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/

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
decltype as a template parameter when containing reference to anothertemplate parameter. Isti C++ 2 04-19-2010 10:01 PM
without declare parameter [double square(parameter)] return 0 in main WanHongbin@gmail.com C Programming 5 10-01-2008 03:31 AM
Using declaration inside first template parameter as default valuefor second template parameter. Stuart Redmann C++ 5 12-14-2007 08:42 AM
Parameter List / Parameter Block / Anything patterns... mast2as@yahoo.com C++ 4 03-29-2007 09:37 PM
lang parameter in anchor tag Tristan Miller HTML 11 09-29-2003 08:22 AM



Advertisments