MCCC CIS 177 - Markup Languages

3.0 Links

2.04 Internal Links

On a long page, you may want to place links that target other areas within the same page so users can easily find the section that interests them. Internal links require internal bookmarks, called anchors. Creating an internal link requires two steps: 1) defining the target area and 2) creating the link to the area.

<a name="targetname">target anchor text and/or image</a>
<a href="#targetname> text and/or image linking to target area</a>

The name attribute of the anchor tag defines an internal bookmark in the page. Note that for the href value, the # symbol is used. This symbol, called a hash, tells the browser to look for an anchor by this name within the current page. Without the hash, the browser will look for an external file by that name.

Examine the code of internal links (bookmark)

Examine the code

2.24 Linking to other objects

Linking to other file types

To create a link to a file the browser can't display, however, that your visitor can download, simply indicate the filename including the appropriate extension in the href attribute. Common formats available for download are .zip, .exe, .pdf, .doc, etc. The browser will either attempt to open the file using a helper program or plugin or will prompt your visitor to download the file. Keep in mind the visitor must have the native application that supports the file type in order to view or execute the file. To save a file without having the browser first display it, right-click on the link and choose Save Link As (NS) or Save Target As (IE) and navigate to where you want to save the file on your local disk. It is highly recommended if you plan to offer downloadable files that you compress the files prior to upload. Most Websites use the zip utility to compress non-Web file formats because they tend to be quite large and require considerable bandwidth.

Linking to other Internet services

You can also create links to other Web services as follows:

  • To cause the user's email client to start a new email message for sending you an email (?subject is optional):
  • <a href="mailto:yourusername@somewhere.com?subject=topic">Text and/or image</a>
  • Link to an FTP server:
  • <a href="ftp://ftp.site.com/path">Text and/or image </a>
  • Link to a telnet site:
  • <a href="telnet://site">Text and/or image</a>