next up previous contents
Next: Pre-Formatted Text Up: The World Wide Previous: More Pretty Pictures

Links Within a Page

The hyper links we've shown so far all take you to the top of the page at the end of the link. However, it's useful to be able to jump to specific places within a page too. For instance, where a page is quite long, it is useful to be able to have a summary of the page at the top, with hyper links directly to the summarised sections. This can be done by associating names with anchors as follows.

If this chapter was called example.html and our publisher allowed us to make it available online, we might put a list of contents at the top:

  <UL>
  ...
  <LI> <A HREF=example.html\#links>Go to Section 1</A>
  <LI> <A HREF=example.html\#more_pics>More Pretty Pictures</A>
  <LI> <A HREF=example.html\#page_links>Links Within a Page</A>
  ...
  </UL>
  ...
  ...
  <A NAME="page_links"><H2>Links Within a Page</H2></A>
  The hyper links we've shown so far.....

Now if you click in the Within a Page'' entry in the contents list, your browser will jump to the document with the partial URL example.html#page_links. As we're already viewing the document called example.html, it doesn't bother to fetch the page again, but merely jumps directly to the anchor named page_links.



Jon Crowcroft
Wed May 10 11:46:29 BST 1995