## Creating and changing links and anchors

### Creating a target anchor

A target anchor is a piece of text that is referred to by a link (a source anchor). Before creating a link to such a piece of text, you must first turn it into a target anchor.

Just select a character string with the mouse and choose Create Target from the Links menu. The selected text is now a target. If you have set the status "Show targets" to your current Formatted view, the text is preceded by an a target icon . In the Links view target icons, which identify target anchors are always displayed (there is no option to show or hide target icons). When a target anchor is created, Amaya automatically generates the NAME attribute value:

- either by extracting a word longer than 3 characters form the anchor content,

- or by generating a number.

In both cases, Amaya guarantees that the generated value is unique.

### Creating a target element

In HTML 4.0, an element can be used as a target of links. A target element is a typed element that has an ID attribute which is referred to by a link (a source anchor). Before creating a link to such an element, you must first turn it into a target element.

You can create a target element in the same way you create a target anchor. Just select a character string within the element, use the Esc (F2 on Windows) key to select the element itself and choose Create Target from the Links menu. The selected element has now an ID attribute, which identifies it as a target element. Amaya automatically generated this unique ID value.

If you have set the status "Show targets" to your current Formatted view , the text is preceded by an a target icon .

It's also possible to directly create the ID attribute by using the Attributes menu when the element is selected. When the value has been entered, Amaya checks this value and changes it if it is already used by another NAME or ID attribute in the same document.

### Creating a link

#### External links

To create an anchor that is a link to another document:

1. Select the extent of the anchor to be created
2. Click the button or choose Create Link from the Links menu
3. If the target document is displayed by Amaya, just click anywhere on it. The link is created.

   If the target document is not displayed

   - click anywhere in the current document, except on a local target icon.
   - a dialog box pops up: enter the URI of the target document and click on the Confirm button. The link is created.

#### Internal links

To create a link to a particular target anchor or a particular target element in the same document or in another, replace step 3 above by:

1. click in any view on the target icon, which should be displayed in the Formatted view or in the Links view. The link is created.

### Removing a link or a target anchor

The Links menu contains a command that reverses the two commands above: Delete Anchor. Put the selection or the insertion point anywhere within the anchor to be removed (you do not need to select the whole anchor, but you can) and activate the Delete Anchor command. The anchor is removed, but its content remains.

### Changing a link

If you want to keep an anchor but to change the target of the corresponding link, select any part of that anchor or just put the insertion point within the anchor, and click the button or choose Change Link from the Links menu. Then designate the new target of the anchor as above (step 3 in the creation of a link).

To change the target of a link, you can also edit the `href` attribute, either directly in the Structure view or in the Links view or using the Attributes menu.