Bright Java Tutorial

is brought to you by DoITBright LLC

HTML

Hyperlink In HTML

The hyperlink tag is used to link the current page where the link is to another page that is specified in the link. Create a HTML document and name it as 'source.html'. Here is the HTML code for it.

  <html>
    <head>
      <title>Hyperlink in HTML</title>
    </head>
    <body>
      This is the page where we wish to place a hyperlink. 
        <br/>
      If you click <a 
        href="target.html">here</a> 
        you will be brought to the 'target.html' page.
    </body>
  </html>
                           
Let us observe the <a> tag. It has an attribute called 'href' with a value of 'target.html'. This declares the hyperlink that is pointing to the 'target.html' page. Just like any other HTML tag, it has a matching closing tag which is </a>. The text in between will serve as the actual link displayed to the user. When the link is clicked, it will go to the 'target.html' page. In order for this example to work, we will need to create a HTML file and name it as 'target.html'. We should save this file in the same directory where 'source.html' is located. Here is the HTML code for it.

  <html>
    <head>
      <title>Hyperlink in HTML</title>
    </head>
    <body>
      Congratulations! You have successfully navigated 
        from 'source.html' tp 'target.html'.<br/>
      Here is another hyperlink to navigate to a page 
        outside your own domain.<br/>
      <a href="http://www.doitbright.com">
        Classified Ads</a>
    </body>
  </html>
                           
The hyperlink example above is pointing to a United States classified ads website where you can find jobs, handyman, air condition technician, plumbers, auto mechanics, furniture, gadgets, collectibles, cars, trucks, motorcycles and many others. In this lesson, you have learned how to point to pages within your own domain and outside your domain.


Back    Next