2.5 Bookmarks and Uses of the NAME Attribute

2.5.1 Bookmarks and Links to Bookmarks

 
The attribute "NAME" for the anchor tab is known as a bookmark. Bookmarks can be used for several purposes and they can be used without having a link, i.e. with nothing specified in the HREF line!
The line "NAME" gives you the option to bookmark any marked section (i.e. just one letter or any "string") of your document with a name of your choice. Whatever you wrote and marked now has a name, and the name is whatever you wrote in the "NAME" line of the attribute list. What is this good for?
Lets find out by a little experimenting:
Mark any word you like and click on the "Insert Bookmark key" (the one with the blue arrow going left and down). A menu comes up that is asking you to write down a name for the bookmark.
Write whatever you like; just a single digit or number is enough. The marked word now carries the anchor tag characteristic for a link. That is because the "Insert bookmark key" is just a shortcut for filling in the attribute "NAME" of the <A></A> link tag.
But if you now look for the attributes of that anchor, you will find the HREF line empty; it contains only the name you typed in the NAME line. The anchor tag thus has another function besides providing links: It can be used to just "bookmark" a certain word or string in your document.
Why is that bookmark function part of the tag for links? Because you can use it to provide a link that does not just jump to the top, i.e. the very beginning of some other document, but to the line that contains the bookmark with the name which you provided in the link!
In other words: if your link goes to some long document, without a bookmark to guide the jump, always the top of the document will appear and you will have to scroll to wherever you are supposed to go. With a bookmark at the right place, the line with the bookmarked word will appear at the top of your screen - you do not have to search for the right part of the document by scrolling up and down!
Obviously, to use this function, you must have two things:
1. You must bookmark appropriate words in the document that your link is leading to.
2. You must provide a reference to this bookmark - its name - in the attributes of the link in the document where you are setting the link.
Unfortunately, its rather easy to get confused with this. Lets see why:
If you look at the attribute list belonging to the anchor tag, it is tempting, to write the name of the bookmark to which the link should go in the NAME line. That will not work! Because if you do this, you bookmark the word that is to carry the link. That might be useful if some link from somewhere else leads to your document, but doesn't help you for the link you are trying to establish.
What you have to do, is to write the name of the bookmark in the HREF line after the address, and always preceded it by a # sign. A proper address carrying a bookmark may then look like this:
../../amat_stud/project/homepage.html#bookmark.
 
This is a bit awkward to work with. You either have to remember the exact name of the bookmark in some document you want to establish a link to, or you must open this document and look it up using the F6 key to find out the name of the bookmark indicated by an <A></A> tag. HoTMetaL therefore provides a short cut.
You must have both files open: the one which should carry the link, and the one the link should go to. Since you cannot insert bookmarks into somebody else's files, but only in your own files, this is always possible to do.
If a bookmark in the target field does not yet exist at the proper place, you make it by activating that file, pressing the "Insert Bookmark key" (blue arrow to the left and down), and writing down the name of your choice.
Now you activate the file that is to contain the link. After marking the string that is going to carry the link, you do not press the "anchor key" for the link, but the "Insert link to bookmark" key (blue arrow up and to the left).
The menu coming up asks for an open file - select the one with the bookmark where the link should go to. All bookmarks in this document are shown, click on the one you want.
You have now established your link to the right file and the right bookmark. If you look at the attributes, you will find your bookmark after the # sign.
However, HoTMetaL pro has a bug in this part which you have to know and correct - otherwise there might be trouble.
The name for your bookmark may consist of more than one word - naturally then with a space in between. As an example take "Insert bookmark"
In the attribute list of the anchor that appears, you will read "...#Insert%/20bookmark" - the %/20" sign meaning "non-breaking space", i.e. a space symbol.
But this will not work. You have to erase it and put in a real spacer "by hand"
 

index.gif zurueck.gif