![]() |
|
Linking DocumentsPerhaps the most important feature of Web documents is the ability to link documents together. Links can be made within a document, with another document in the same directory, with documents in other directories and with documents right across the globe. All that is required to link to another document is to know its location. In HTML these locations or addresses are called URL's or Universal Resource Locators. You can use your Document Source function in the View menu to look at the source of this HTML document Making your first linkOur first HTML document was saved in a directory using the file name firstdoc.htm. If we mark up a new document and put it in the same directory then the address (URL) to locate it is very simple:<a href="firstdoc.htm"> (A stands for anchor or link HREF means hypertext reference and everything after = is the URL of the file you are linking to ).
The completed link tag might look like this:
<a href="firstdoc.htm">Click here to see the first document</a> A link to to Macquarie Universtity Home Page would be: <a href="http://www.mq.edu.au">Go to Macquarie University</a> A link to purhase a CD online from USA would be: <a href="http://www.cdnow.com">Click here for CDs</a> Now open your word processor and make the new document: Dont forget the forward slashes (/). Try it out for yourself. Save it as a text file called secdoc.htm and, after you've saved and closed the document in the same directory as the first one, open it with Netscape using Open File under File in the Menubar.
Take a look at the wording that you typed between the anchor tags. Run the mouse pointer over these three lines and see what happens at the bottom of the Netscape window. Now click on one of the three lines. Linking to files in other directoriesIf the linked document is not in the same directory then a path has to be specified pointing to another directory. Netscape gives you feedback if it cant find the file in the link. This feedback helps you work out what the correct address should be. Note that UNIX naming conventions are used for URLs, so the URL "colour/green.htm"
indicates a file "green.htm" in a directory "colour" situated in the current
directory. If you wish to move to the parent directory two dots and a
forward slash are used as in "../index.htm", indicating a file "index.htm"
in the parent directory of the current directory! Linking to other Web sitesURLs or addresses identify a particular directory or file, on a particular server, at a particular company or institution, in a particular country etc just like a street address identifies a house. Some URLs can be very long..The easiest way to link to another web site is to copy the URL from the browser and paste it in between the quote marks of the A HREF tag Examples of URLs. Australian Folk Songsurl is http://www.cpd.mq.edu.au/boomerang/songnet/ Australian Broadcasting Corporationurl is http://www.abc.net.au/
Sydney Morning Heraldurl is http://www.smh.com.au/ |