[Index]
[Up]
[Back]
[Next]
4.5.1 HREF in Anchors
As mentioned previously, anchors mark the
beginning or end of hypertext links. The HREF
attribute (which is optional) marks the anchor as
the start of a link to another document, or
to a particular place in another document.
The address of the referenced document is specified by an
absolute or relative URL:
<A HREF="URL"> anchor </A>
Where `URL' (Universal Resource Locator) is the
URL of the document to be accessed.
For example HREF can use http to access other HTML
documents, images, etc. or it can use ftp or
gopher. It can even indicate a telnet connection.
See the URL document for more information
on thee possibilities.
`Relative' URLs are also possible when accessing http servers.
These are convenient for referencing documents from the
same http server as the current document. In this case
you need only specify the location of the document relative to
the current one. Here are some examples of the varied possibilities:
- http://www.web.edu/u1/stuff/doc.html
- HTML document served by the specified http server.
- ftp://ftp.nccc.edu/pub/doc/blob.tar.Z
- Compressed tar file accessed via anonymous ftp from the
indicated site.
- ../../OtherStuff/thing.html
- A relative URL: the HTML document comes from the same
http server but in the directory OtherStuff, found
two levels up from the directory the current document was served
from.
- telnet://flober.rodent.edu
- A telnet session to the indicated machine.
Links to a Particular Place in a Document
Particular places in an HTML document can be marked as specific
destinations of hypertext links via the
NAME attribute. For example, suppose a place
in a document is marked via
<A NAME="proj1">Project 1</A>
From within this document we can create a hypertext link to
this place by specifying the anchor:
<A HREF="#proj1">(see Project 1)</A>
If we wanted to reference this place from another document in the
same directory we would put
<A HREF="doc.html#proj1">(see Project 1)</A>
and so on.
HTTP Servers often allocate special URLs for specific types of files.
The most important one is /cgi-bin. This is used to
reference the `server scripts' directory -- this is the directory
that contains scripts and programs that can be accessed from the
browsers, via an HREF. For example, to access the script `phone'
(which scans a phonebook for particular names) on the machine
`www.foo.com' via http, the HREF is
HREF="http://www.foo.com/cgi-bin/phone"
For more information look at Section 6;
you should also consult you local httpd server documentation.
[Index]
[Up]
[Back]
[Next]