Programmatically scroll to an Anchor Tag

Posted by Anders on Stack Overflow See other posts from Stack Overflow or by Anders
Published on 2008-11-05T16:40:29Z Indexed on 2010/05/20 8:00 UTC
Read the original article Hit count: 141

Filed under:
|
|

Consider the following code:

<a href="#label2">GoTo Label2</a>
... [content here] ...
<a name="label0"></a>More content
<a name="label1"></a>More content
<a name="label2"></a>More content
<a name="label3"></a>More content
<a name="label4"></a>More content

Is there a way to emulate clicking on the "GoTo Label2" link to scroll to the appropriate region on the page through code?

EDIT: An acceptable alternative would be to scroll to an element with a unique-id, which already exists on my page. I would be adding the anchor tags if this is a viable solution.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about anchor