Virtual University Design and Technology, ANGEL Tips & Techniques
Previous Page
Next Page

Named Anchors

Named anchors within a page are a nice way to make it easier to find an item within a long page. However, they just don't work properly in ANGEL without a bit of extra effort, namely JavaScript.

We have written a script specifically for this purpose. Follow the steps below if you want to use named anchors in one of your pages.

Steps

  1. Include the following code at the top of your page:

    <script src='/MSU_Jscript/named_anchor.js'></script>

  2. Use the code below to create your anchor:

    <a name="your_anchor_name"></a>

  3. Use the code below to create your links:

    <script>
    named_anchor('your_anchor_name', 'Link Text');
    </script>

Example

In my page I want to have a named anchor at the top of the page so that I can put a link at the bottom of the page that when clicked, takes me to the top of the page.

I put the following code at the top of my page to create the anchor:

<a name="top"></a>

Normally, I would use the following code at the bottom of my page to create a link to the top of my page:

<a href="#top">Go to top of page</a>

Unfortunately, within ANGEL the link would not work properly. So instead I have to use the JavaScript code below to create a link that will appear exactly the same as the one above and works:

<script>
named_anchor('top', 'Go to top of page');
</script>

Previous Page
Next Page

Last updated: August 16, 2007
This website is maintained by vuDAT
Copyright © 2008 Michigan State University Board of Trustees
MSU is an affirmative-action, equal-opportunity employer. East Lansing, MI 48824 USA
Michigan State University