getting a href anchor to work

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

getting a href anchor to work

Post by mesz »

snippet of large php script

Code: Select all

<?php
echo "<a class="fab_blue_small" 
href=".//gallery_ms/forumesque/view.php#$caption"
onMouseOver="window.status=''; return true" target="blank"> 
view specifications & more info 
</a>";
?>
code at view.php

Code: Select all

<?php

  echo "<form class="form2"><b><a href="#$pieces[1]  ">" .     $pieces[1] . "</a></b><br>" . $pieces[3]. 

"<br>" ; 
    echo " d e t a i l s - <br>" . $pieces[2] .  "<br>" .  "<small>info updated on ".$pieces[0] ."</small></form>"  ; 
?>
However viewer does not link to correct anchored position.
Client simply links to top of the page.
How do I get the anchor to work.
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

where is you anchor point

Code: Select all

<a name="anchor_name">
in view.php
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

Post by mesz »

"<form class=\"form2\"><b><a href=\"#$pieces[1] \">" . $pieces[1] . "</a></b><br>"
here.
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

No, I think you do know that they're two parts to it. One, where you click and Two, where to goes.

One, where you click:

Code: Select all

<a href="#foo">foo</a>
Two, where it goes:

Code: Select all

<a name="foo">
This is where foo is in the page, you have come here since you clicked foo somewhere else in the page.
</a>
So we're wondering where did you put the <a name="">?

-Nay
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

Post by mesz »

I am an idiot ! I forgot the most basic things whilst getting bogged down in all this programming malarkey
User avatar
mesz
Forum Contributor
Posts: 216
Joined: Fri May 23, 2003 8:11 am
Location: M/cr

Post by mesz »

all working. I really did forget to replace href with name, doh!
Cheers y'all.
Post Reply