Weaving your Webpage



Links, where to go and how to get there:

     Links are what make Web documents unique. Unfortunately, some of what is required to create a link is slightly complicated. The most complex part of it is the URL that points to the resource you're linking to.

     A URL is the address of a document or resource. It usually takes this form:

http://www.earthspace.net/index.html

    The easiest way to get the URL of a document is to find it using Netscape, Mosaic, or Cello and then copy the URL into your HTML document. In Netscape you can either copy the text in the "Location" box at the top of the Window or click on the link with the right mouse button and choose "copy link to clipboard."

Putting Links in HTML documents

     The HTML command for putting a link into a document takes this form:

<a href="URL">text of link</a>

     You put the URL in the quotes following the "href=" and put the text of the link (the part that users will click or select to activate the link) after the > and before the </a>.

Links to Specific Sections

     Links can also be used to move a reader to a particular section in a document (either the same or a different document) rather than to the top, which is the default. This type of an anchor is commonly called a named anchor because to create the links, you insert HTML names within the document.

Links Between Sections of Different Documents

     Suppose you want to set a link from document A (documentA.html) to a specific section in another document (document2.html).

     Enter the HTML coding for a link to a named anchor:

documentA.html: Many images can be seen at the <a href="document2.html#ANP">NASA Archive</a>.

     Think of the characters after the hash (#) mark as a tab within the document2.html file. This tab tells your browser what should be displayed at the top of the window when the link is activated. In other words, the first line in your browser window should be the NASA Archive heading.

     Next, create the named anchor (in this example "ANP") in document2.html:

<H2><A NAME="ANP">NASA Archive</a></H2>

     With both of these elements in place, you can bring a reader directly to the archive reference in document2.html.

     NOTE: You cannot make links to specific sections within a different document unless either you have write permission to the coded source of that document or that document already contains in-document named anchors. For example, you could include named anchors to this primer in a document you are writing because there are named anchors in this guide (use View Source in your browser to see the coding). But if this document did not have named anchors, you could not make a link to a specific section because you cannot edit the original file on NCSA's server.

Links to Specific Sections within the Current Document

     The technique is the same except the filename is omitted. For example, to link to the ANP anchor from within document2.html, enter:

...More information about <A HREF="#ANP">NASA Archive</a> is available elsewhere in this document.

     Be sure to include the <A NAME=> tag at the place in your document where you want the link to jump to (<H2><A NAME="ANP">NASA Archive</a></H2>).

     Named anchors are particularly useful when you think readers will print a document in its entirety or when you have a lot of short information you want to place online in one file.