Jump to content
Larry Ullman's Book Forums

Anchor Point Hyperlink Example?

Recommended Posts

It's very good use IDs in longs texts. Think law data, etc. That way, you can link directly to a heading (or other element) in the middle of a web page.


Where you call the method:

// inside a class
$param = array("#" => "law-4.2")

$this->someMethod($param); // Might have other params...


And in a view file:

<!-- Creating a heading with an anchorID -->
<h2 id="law-4.2">§ 4.2 - Important law</h2>


Where the URL would look something like:


Link to post
Share on other sites

Antonio: I'm not familiar with your html syntax. 


I've always done it this way:



<p><a href="#Arrive here">Click here</a></p>
<p> </p>
<p><a name="Arrive here">Arrive here</a></p>
My way does not involve any id, which is why I did not understand the term "anchorid".
I am puzzled that we are creating anchor points differently. What do you think?
Link to post
Share on other sites

This is a totally minor point, but it's more conventional to use IDs for anchors these days. In part this is because IDs are often being used for other reasons already and using "a name=" has no meaning except as an anchor.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...