Links
The whole idea of the web revolves around the idea of documents linked to
other documents. To make a link to another document, you must first know
the URL (Universal Resource Locator). An example of a URL is
http://www.yahoo.com/ or http://www.lycos.com/. It's just the server
name with it's proper designations. It can also have a document name
attached. Like http://www.w3c.org/TR/REC-html40/html40.txt
To create a link, you must know the URL and you must make an anchor.
An anchor is the <a> tag. To make a link to
http://www.advanced.org/, and make the words "click here" be the link,
you'd add this to your html document:
<a href="http:/www.advanced.org/">click here</a>
which will look like this:
click here
You must remember to use the </a> tag or all of the text that
appears after the
<a href="http://www.advanced.org/"> tag will be a link to
http://www.advanced.org/.
What else can you do with anchors? You can set the name location of an
anchor, and then link to it. Useful if you have a large document, and you
want to link to a certain part. Now you create an anchor to the place
where you want to jump to (it has to one of your documents) and you put a
link to it somewhere else. So there's a link from an anchor to an
anchor.
<a name="location1"></a>
if that was in the file "home.html"
and you wanted to make a link to that particular spot on home.html, you'd
make a link like this:
<a href="home.html#location1">go to location 1</a>
Need a demonstration? Do you see where I wrote "What else can you do with
anchors?" I'll put this anchor there:
<a name="moreanchor"></a>
and since this document is links.html, I'll make this link to it:
<a href="links.html#moreanchor">more about anchors</a>
more about anchors
And when you click on that, you jumped to the place where I put the
<a name="moreanchor"></a> anchor.
Got it?
Next lecture