HyperWrite - Consultancy and Training 

Help Systems, Structured Authoring, DITA, Hypertext, Documentation Technologies

HyperWrite Logo
Skip Navigation Links
Skip Navigation Links

Bookmark (Anchor) Linking Tip

Linking to a specific point on an HTML page is normally done using anchors, or bookmarks. Typically, these work by adding an anchor (or bookmark) to a Web page using a tag such as:

<a name="important_part">

A link to a bookmark is made using syntax like:

<a href="#important_part">

or, if the anchor is not on the current page:

<a name="bookmarklinking.htm#important_part">

You can see this working by trying it out now.

There is another method, however, which isn't as well known. You can link to any tag within the page by quoting its ID. For example, if you have a paragraph with an ID of "intro", then you can link directly to that point without having to insert a bookmark. The link tag syntax is exactly the same as it would be for a standard bookmark:

<a href="#intro">

You can see this working by trying out this link.

Apart from simpler coding, there is a bonus with this method (although the bonus only applies to Internet Explorer). If you link to a form field, IE will set the focus to that field. This can be especially useful if you are providing Help for a Web-based form, and want to redirect the user to a particular field. You can try this out (if you are using IE) on a sample form. With other browsers, the link will still work, but the form field won't get the focus.

With a bit of ingenuity, you will be able to exploit this technique to make your content more effective.

 

 

 

 

 

 


Test Area

This area of the Bookmark Linking Tip is simply provided to test the various linking effects within this page.

 

Important Part - This paragraph has an anchor tag with a name of "important_part". Return

 

Paragraph with an ID of "intro" - This paragraph has a simple ID attribute. It wouldn't have to be a paragraph. It can be a heading, or even a form field. Return

 

Sample Form

Name: Enter your name in the Name field

Address: Enter your address in the Address field

Return

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Valid XHTML 1.0 Transitional Valid CSS!

Training

HyperWrite provides training in a number of authoring software tools, and in structured authoring, technical writing and Help authoring techniques. Find out more...