If you want to link from one page to an other you use a hyperlink. Hyperlinks
are elements that have a simple purpose to link. The element that those the linking
for you is the <A> element. The <A> has a start and end tag </A>. The content of the
<A> are inline element. Here are the main attributes of the <A> element.
href This is the main attribute. It's purpose is to give the destination
for the link.
name Name of an anchor. This is used to link to locations on the same page.
target The target attribute identifies which frame in a frameset gets loaded
with the content of the link. There are 4 reserved target names: _blank, _self, _parent, _top.
_blank This causes the link to be loaded into a new browser window.
_self The result of the link will be loaded in the same frame as the <A> element, that
created the link.
_parent This causes the result of the result of the link to be loaded into the
FRAMESET parent (more about frames here) of the current frame.
_top This causes the result of the link to be loaded into the full browsers window, cancelling frames.
This is very useful if you have the "home" button, so you wouldn't end up with the problem of unintentionally
nested frames.
Linking to pages in the same directory
This is the easiest type of link. You only have to specify the name of the file you are linking to.
Here is a simple example:
<A href="page2.html">Go to page two</A>
This link will load the "page2.html" file into the window (frame) where the link is located
Linking to pages in other directories
The only difference is that you have to specify the directory name where the file is located.
If you need to navigate trough your directories to come to a certain file, you can take advantage of
the double dots (..). They take you one directory up.
Here how it all looks like:
<A href="../../company/quotes/this_year.html">Here are the quotes for this year</A>
Linking to external pages
This is a common link if you want to link to a page you like and think people should see it.
This is a link you should include in your web page:
<A href="http://www.proximadesign.com">All you need to know about web page design</A>
Linking to locations on the same page
What if you have a long page and want to link to the middle of the page? You can use the named anchor
for this purpose. A named anchor is simply a point on the page to which you can link directly.
First you need to create a named anchor:
<A name="september">September 2000</A>
There are no rules about names for the anchor, except they can't have spaces in them.
Now if you want to link from somewhere else in the same page to that month you need to create a link
<A href="#september">Quotes for September </A>
You can link to this anchor from other pages as well.
<A href="../company/quotes/this_year.html#september"> See quotes for September</A>
Linking to pages from images
You can use images to link to other pages or other section on the same page. The only
difference is that you use the <IMG> element as the content of the link instead of text.
<A href="http://www.proximadesign.com"><IMG src="logo.gif" alt="Go to Proxima Design"></A>