Links
This example illustrates some of the things that can be done with the <A> tag using the
< href > attribute.
When used with the HREF (hyper Reference) attribute, the enclosed text and/or graphic becomes a link to another document. Clicking on the link does the same as putting the link's URL (Universal Resource Location) in the browser's URL field and closing the ENTER key. It can also be viewed as a book-mark whose location field contains the URL. The most common URL is another web page, but there are other URL's that are useful. Some examples will be given in this presentation.
Use a URL of your choice; however I will use the htmlgoodies web page for this example.
The http: (Hyper Text Transfer Protocal) tells the browser that the link is to a web page on the internet.
The HTML code is immediately below. The link it creates is in the following line.
<a HREF="http://www.htmlgoodies.com">Internet Link</a>
Internet Link
Mouse over the link, the URL will be displayed in the task bar at the bottom of this display. Click on it and it will display the URL's web page.
The text in the tag that immediatly follows the URL is the link itself.
Notice that the <Body .. .. > tag also contains three new attributes that affect the colors of the link text.
The LINK color is (#FF0000) RED. The color of the link before having been visited. Clear BROWSER HISTORY to enable this attribute's color.
The ALINK color is (#00FF00) GREEN. The color of the link as it is being clicked on and right-clicked on.
The VLINK color is (#0000FF) BLUE. The color the link becomes after being visited and its URL is in the BROWSERS HISTORY.
A folder may be displayed on the disk using file: instead of http: instructing the browser to locate the source on the disk instead of the internet.
<a HREF="file://C:"> Root Directory </a>
Root Directory
An image file in the local directory can be opened with the browser as long as the browser has the module or an update to open it. A gif and jpg file can be opened with a link statement. Notice that if the file happens to be in the local directory with the HTML file, then the full directory path isn't necessary. I don't need to put ///c:/ in front of the file name in the link tag because herman.jpg is in the same folder as this LINK.HTML that we are viewing now.
<a HREF="file:Herman.jpg"> Good old Herman </a>
Good old Herman
You may remember having seen a wee little pop up with text in it when placing the mouse cursor over a link. It doesn't stay there long, but it usually tells us something about the link that is activated. This is called Alternate text.
<a
HREF="file:Herman.jpg" title="The pop-up from the title= attribute">
Put Cursor here </a>
Put Cursor here
These are only a few of the things that can be done with links. It is enough to be able to create the set of web pages used in this tutorial. Do a google on HTML Links and there are a myriad of sites available to consider for your code. Again... the whole idea is to have some ideas to have fun with. Try out some new ideas of your own. Try changing the format of the tag to see if there any changes in the display. Its an adventure.......
I can create a HOME link to return the home page for this tutorial using an image rather than
some text with my own neat little image like home.gif and return.gif.
I created my gif with transparant background and
selected no border for this demonstration.
<A HREF="../HOME.htm"><IMG SRC="Home.gif" BORDER="0"
title="This is the link to the tutorial HOME page"></A>
<A HREF="./html.htm"><IMG SRC="Return.gif" BORDER="0"
title="This link returns back to the HTML section"></A>
Pay particular attention to the dots between the href=" and the / filename. Each dot retpresents the number of parant folders necessary to traverse back to the html file that you wish to link to, from this local "current" folder. Two in the case of HOME.htm and one in the case of the HTML.html folder. To avoid using the dots, simply use the full DOS pathname and not even use dots to define relative folder locations. Research URL, folders, directories, and DOS paths to learn more about how files are located in the FAT (file access table).