|
All right, it's time to learn how to link to another page.
So let's start out by seeing what tag we use for linking:
<A HREF="http://www.someplace.com">Display Text</A>
The A stands for anchor, and the HREF=" " is asking for a location
to link to. The </A> is the closing tag. The text between
the tags is what will show up on your web page as a link. So,
if you would like to link to our site, you would place our url,
or net address, inside the quote marks. Our url is http://www.mysite.com,
so to create a link to us, place this command on the page where
you would like the link to show up:
<A HREF="http://www.mysite.com" target="_blank">my web site</A>
It will show up on your page like this:
my web site
See how the text was colorized and underlined?
In most cases, this will indicate the text is a link. If you
move your mouse
over the link, you should see the cursor change into a pointing
hand. The mouse attribute comes in handy when a page has a whole
lot of underlined text.
By default, a link will open the new window in
the same window as itself, replacing itself in effect. So by
adding the bit that says target="_blank" the target of the
link has now opened in a new window instaed of the same one. As another example, let's create a link to this particular
page. Look in your location box near the top of your web browser.
You should see the url for this page, which is http://www.mysite.com/html/linking.htm . To create the link, insert this url into the link tag:
<A HREF="http://www.mysite.com/html/linking.htm">Linking
to Other Pages</A>
Which gives us this link:
Linking
to Other Pages
If you click on this link right now, your browser
will simply display this page again. If you click on the link
from the first
example, you will end up at our home page. Great isn't it? Now,
if you want to link to your own pages from your home page, just
type in the address for your page inside the link tag. This will
work for any page because we are using the absolute url, which
means we are using the complete address to every page we are
creating a link to. If you have all of your files in the same
directory, you may use a shortcut called a "local url". Before
you try this, be certain any file you want to create a local
url link to is in the same directory as the page you are editing.
(In most cases, it will be) Now, rather than typing the full
url inside the tag, you can just use the filename, like this:
<A HREF="linking.htm">Linking to Other Pages</A>
This will create the same link we just did, but we didn't have
to write as much.
Linking
to Other Pages
If you aren't sure or have doubts, always use the absolute
url. Typing in the full address will allow the link to work no
matter where it is located on the internet.
|