Anchors elements are used to link multiple HTML documents. It requires only one tag viz., the <A> tag. It occurs only in the body of an HTML document. If an anchor is used to turn text into a hyperlink, the text is usually colored blue and underlined.
<A href =" " > Content </A>
If you want to create a hyperlink which will take the user to a different page href or hypertext reference is mandatory. For without it, the anchor will not function as a hyperlink.
Hyperlinks can be of two type:
(1) Links to an external document
(2) Links to a specified place within the same document.
EXTERNAL DOCUMENT REFERENCES
It links the source document to a specific external document.
< A href = "main.htm"> Home </ A>
Here "HOME" becomes a hyperlink and links to another document. "Main.htm" which is present in the current working directory. If the file is not present in the current directory a relative or absolute path can be specified.
By default a hyper link takes a user to the beginning of the new web page. At times it might be necessary to jump to a particular location within the new web page. To enable a jump to a specific location in a web page, Named Anchors can be set up.
Named Anchors are used to create links to a specific location within a page Jumping to a particular location on a web page can be summarized in two steps.
Step 1 : Mark the location to be jumped to i.e. identify the location in a web page to jump to by giving the location a name.
The "Name" attribute of <A> tag does this
<A Name = "Location-name" >
< A Name = "location 1">
This identifies to jump at location l
Step 2: While jumping to a specific web page and a specific location on the web page, in addition to the name of the web page to be jumped to, the name of the location on the web page to go to is required.
A web page will really be contained in an HTML file. Hence the web page to jump to really requires a filename. ·htm, together with the name of the location to jump to in the HTML file. This is done as follows;
<A href = "file_name. Htm # location_name" > </A>
<A href= "Main.htm # location 1" > Home </ A> Home becomes a hotspot and leads to a location named location 1" in the file "Main.htm".
The following lines of code show the use of external links:
<HEAD><TITLE>EXTERNAL LINKS </TITLE></HEAD>
<H2><P>Discover More about Dreamweaver 4 </P></H2>
<A HREF="D:\CODE\lNTRO\DLL.HTM#ONE">What's New in Dreamweaver 4 <A><BR><BR>
<A HREF="D:\CODE\OL 1.HTM#TWO">Dreamweaver Web Site </A><BR><BR>
<A HREF="D:\CODE\OL2. HTM#THREE">Dreamweaver Exchange</ A><BR><BR>
<A HREF="D:\CODE\OL3.HTM#FOUR">Release Notes</A><BR><BR> </BODY> </HTML>
CODE OF REFERENCED DOCUMENT
<HEAD><TITLE> TEXT FIELDS</TITLE></HEAD>
<A NAME= "ONE"><H2> New in Dreamweaver 4</H2>
It highlights the exciting new features included in this release. Thanks to people like you, Macromedia Dreamweaver has become the standard solution for professional web development on both the Windows and Macintosh platforms.
As you can observe in the code of main document not only the document name (DLL.HTM) but also the name of the location (/fone") to be referenced is mentioned. Also you will notice in the document (DLL.HTM) the heading "New in Dreamweaver 4" is given an identification number "one" respectively. So when one clicks on the highlighted portion say What's New in Dreamweaver 4 in Figure the href attribute links the user to that part of the external page which is defined by <A NAME= "ONE">. Similarly names of external files and their respective location name are specified for headings Dreamweaver Web Site, Dreamweaver Exchange and Release Notes.
INTERNAL DOCUMENT REFERENCES
Sometimes a jump is required to a different location in the same document. For example at the bottom of a long page you can provide a link to the top by using named anchor. Now the visitor won’t need to scroll the entire page and can jump directly to the top by just using a mouse click.
Since the jump has to be targeted to a specific location the same two steps need to be performed as before i.e. identify a location with a name and then jump to that location using the name. The only difference is that the file name. ·htm now will be the current file name.htm
<A NAME = "location-name/”>
<A href = " # location_name " >………………. </A>
The absence of the filename ·htm before the # symbol indicates that a jump is required within the same document.
<A NAME =” location 1”>
<A href = “#location 1”> Home </ A>
Home becomes a hotspot and leads to a location named location1 in the same Document.