| Warning: include(http://www.studio6000.com/tutorside.htm) [function.include]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/studio60/public_html/html/lesson14.php on line 17 Warning: include() [function.include]: Failed opening 'http://www.studio6000.com/tutorside.htm' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/studio60/public_html/html/lesson14.php on line 17 |
LinksAnchor tags are used to create links. These are anchor tags:<body><a> </a> </body> Then we'll need to insert the href attribute. This tells the browser what the name of the page we are linking to is. <body><a href="pagename.html"> </a> </body> Then we need to put the text that we want to appear as a link in between the opening and closing anchor tags. <body><a href="pagename.html"> This text is a link.</font></body>
Let's test it out. Copy and paste the following code into a blank notepad file and save this file as page1.html. Next, copy and paste the following code into a new blank notepad file.
Now, save this file as page2.html. Make sure that you save it in the same directory (meaning the same folder) as the page1.html file. The page1.html file page should look like this:
This page2.html should look like this:
Notice how when you click on the link "Go to Page 2" on page1.html the browser will take you to page2.html. And when you click on the link "Go back to page 1" on page2.html the browser will take you to page1.html. Good for you! You have just created you very first links! Please Note: The examples above explain how to link to another page that is located in the same page your link is in. If you want to link to a page that is in a differnt folder then you would have to add the folder name as follows: <body><a href="foldername/pagename.html"> This text is a link.</font> </body> Linking to another websiteTo link to another website you will need to include the entire url as the value of the href attribute.Here is an example of a link to Google's website. <body><a href="http://www.google.com">Google</a> </body> The result would be: Linking to an email addressYou can also link directly to an email address. Try the example below. Once you click on the link below, your default email program will open with the email address already in the "To" box.The code for linking to an email is a bit different. Below is the code for the link above. <body><a href="mailto:info@studio6000.com"> Contact us</a> </body> The only difference is, instead of a web address as the value of the href attribute the value will be mailto: and then the email address. |