Logo HTML Topics: Document Links

Course Material Index  Section Index  Previous Page  Next Page 

Document Links

Hyperlinks enable readers to hop from one web page to another. However, with badly designed web pages, they can lead to random hopping through hyperspace with no clear direction in mind. Clear and simple navigation schemes are therefore essential when hyperlinks are used. Hypertext links can link either to another document or to a point in the same document.

Links to another document

This is achieved by enclosing text with <A HREF="URL"> and </A> tags. The text that you enclose will become highlighted when the document is viewed, and clicking on this text will direct the browser to the target document. You must specify the appropriate URL (which is three letter abbreviation for "Uniform Resource Locator"). URLs usually start with "http://" followed by the internet name of the web server, subsequently followed by a directory (or directories) and a filename. For example, typing the following when creating a document will allow the word 'LINK' to link to the document that you are reading now:

<A HREF="http://pd.cryst.bbk.ac.uk/pdnn/internet/doc.htm">LINK</A>

The above link contains an absolute URL since it specifies the web server, directory, and filename. If you are writing a document in which you want to link to another document on your own server (or local document) you need only use a partial or relative URL. For example, if in a document you write the following:

<A HREF="doc.htm">LINK</A>

then the word 'LINK' will, from the URL of the current document, form a link to the named document which resides in the current directory. Note that a relative URL such as "../doc.htm" would point to a file called "doc.htm" in the parent directory and "photos/doc.htm" would point to a file of the same name in a sub-directory called "photos".

Links within a document

This is useful if your document is relatively long and needs some cross referencing. An internal anchor is called by enclosing the appropriate text with <A HREF="#label"> and </A>. The link is made to the required word or text which is labelled by enclosing it with <A NAME="label"> and </A>.

In this example, the words 'FROM HERE' would link to the words 'TO HERE' which is located elsewhere in the same document:

<A HREF="#one">FROM HERE</A>

links to

<A NAME="one">TO HERE</A>


Course Material Index  Section Index  Previous Page  Next Page 
© Copyright 1995-2006.  Birkbeck College, University of London.
 
 
 
Author(s): Huub Driessen
Sami Raza
Oliver Theis
Ian Tickle