COMMUNICATING BETWEEN HTML WEBPAGES AND OBJECTS

For this moment, I will define an object as images and/or sounds. This definition will be altered greatly in the program.

     
Communicating between pages is done through the use of hypertext links (or links). The format for one is listed below:

<a href="webpage">Text/images go here</a>
     
Open index.htm, and after the paragraph break parapgraph, the the following, which will allow you to click the link to index2.htm in index.htm:

<a href="index2.htm">Click to load index2.htm</a>
    
 Double-click index.htm on the desktop, and click on the link. See what it does.
    

 Now let's communicate with objects. You will need Windows 98 to be sure you have all the files, or link to your own files! We will add an image, sound, and text file to the page. Click the Back button of your browser to return to your webpage after clicking on the text file and image link you make. An example is provided to allow these two files to be opened in their own window so that you won't have to deal with the hassle of moving back to your webpage. Use the following formats:

Image: <a href="../clouds.bmp">Click to open clouds.bmp in your browser</a>

Sound: <a href="../MEDIA/chimes.wav">Click to play chimes.wav</a>

Text File: <a href="../tips.txt">Click to view tips.txt in the browser</a>
     

Here are the examples to open tips.txt and clouds.bmp in a new window:
Text File: <a href="../tips.txt" target="_blank">Click to view tips.txt in the browser</a>

Image: <a href="../clouds.bmp" target="_blank">Click to open clouds.bmp in your browser</a>
     

The folder names do not have to be capitalized. The "../" stand as a relative link. This particular symbol means to move up one folder in the folder hierarchy. Another way of specifying a relative link is by specifying the folder, then the file, or just a file by itself (which you've already done). Here is an example (which will not work if clicked on unless placed on the root folder of your hard drive (C:/)):
<a href="WINDOWS/clouds.bmp" target="_blank">Click to open clouds.bmp in your browser</a>
     

Finally, you can specify a link using an absolute link. By doing this, you are given the full path to a file or webpage. Instead of using relative links, I could've used absolute links defining the location for each file, which I list below:


Image: <a href="file://C|/WINDOWS/clouds.bmp" target="_blank">Click to open clouds.bmp in your browser</a>


Sound: <a href="file://C|/WINDOWS/MEDIA/chimes.wav" target="_blank">Click to play chimes.wav</a>
Text File: <a href="file://C|/WINDOWS/tips.txt" target="_blank">Click to view tips.txt in the browser</a>
    

 Finally, if you wish to provide a link to your favorite website, which I'll use mine as an example, it must be written in this format or it won't work. In no way is an URL (Uniform Resource Locator; the website's address) to someone else's website ever a relative link.
<a href="http://www.egbaba.in/index.html">Click here to go to my website</a>
     
Note: When specifying either a relative or absolute paths, you may exchange a slash "/" with a back slash"\", but you must use one or the other. It is not a good idea to mix them

Share this

Related Posts

Previous
Next Post »