2

I thought that it would be a simple matter to use a named anchor to Hyperlink to a specific row of a table. Apparently it's not as easy as I thought. Anyone have any suggestions on how I can accomplish this feat? Thanks for any input.

Doug

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
user3311045
  • 689
  • 1
  • 7
  • 15
  • possible duplicate of [table row as anchor](http://stackoverflow.com/questions/11254860/table-row-as-anchor) – Ninjakannon Sep 22 '15 at 19:03
  • If the answer provided worked for you, don't forget to accept it (click the checkmark next to it) so that user gets credit for giving a good answer :) – Andrea Sep 22 '15 at 19:36

1 Answers1

3

You need to use ids. The # sign inside the href attribute means the link will go to the same page starting where the id is. You then need to add the same row name to your tr element.

<a href="#my-row">Go to Row</a>

<tr id="my-row">

Link to a Fragment - link It is often usefull to link to other places on the same webpage, such as other sections or chapters further down the page.

The technical term for this is linking to a Fragment, where browsers will automatically try and scroll to that part of the page.

Fragments first need to be defined somewhere in a webpage by giving them a name, for example , then links to this fragment are created by using the hash (#) character: Link.

To link to a fragment on another page you would simply append the fragment name to the address, for example: href="example.html#fragment_name".

Source: http://www.simplehtmlguide.com/linking.php

Richard Hamilton
  • 25,478
  • 10
  • 60
  • 87