Scrollable Table: Jump to anchor

I plan to use the code on the following page to create a table where the content is scrollable but the header and footer are static.

However, I would like to create one or more links to anchors (or rows with ids) within the table which would allow users to 'jump' to a specific row - ie the table would scroll so that the required row is shown at the top of the scrollable area.

I'm guessing that this can't be done with HTML and CSS, so what would I need to do in terms of javascript?

Who is Participating?
I am not sure the section technique is usable in this case, but worth you a try.

This link points to a certain section in the same html and allow jumping when clicking the link
<a href="#C4">Go to cell 4</a>
<h2><a name="C4">cell 4</a></h2>
<p>This chapter explains ba bla bla</p>

Open in new window

GarveAuthor Commented:
No, that would work if the table wasn't scrollable, but not here.

I guess what I'm doing might be better explained like this.

It's equivalent to having a div of a specific height set to overflow:auto; where I want to be able to scroll the contents of the div to a specific point.

Using an anchor as you suggest would scroll the whole page to a specific point, not just the div.
David H.H.LeeCommented:
Hi Garve,
quincydude's solution is work for your preferred anchor that set in any places in your web site.
Here i modify one of the cell that named "cell1" inside the scrollable table that provided in link. It is still working fine. You need to set the anchor's id as you need first. Please provide more details you trying to archieve something else there.
GarveAuthor Commented:
Thanks - I had placed my anchor like this

<a name="jump"></a>

but if placed within the cell it works.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.