Sams Teach Yourself HTML 4 in 24 Hours

Sams Teach Yourself HTML 4 in 24 Hours

By Dick Oliver

Linking to a Specific Part of Another Page

You can even link to a named anchor on another page by including the address or name of that page followed by # and the anchor name.

Figure 7.4 shows several examples, such as the following:

07fig04.gif

Figure 7.4 To link to a specific part of another page, put both the page address and anchor name in the <a href> tag.

<a href="sonnets.htm#131">
You're bossy, ugly and smelly, but I still love you.</a>

Clicking You're bossy, ugly and smelly, but I still love you, which is shown in Figure 7.5, brings up the page named sonnets.htm and goes directly to the point where <a name="131"></a> occurs on that page (see Figure 7.6). (The HTML for sonnets.htm is not listed here because it is quite long. It's just a bunch of sappy old sonnets with <a name> tags in front of each one.) Note that anchor names can be numbers, words, or any combination of letters and numbers. In this case, I used the sonnet number.

07fig05.jpg

Figure 7.5 This page is listed in Figure 7.4. All the links on this page go to different parts of a separate page named sonnets.htm.

07fig06.jpg

Figure 7.6 Clicking the bossy link in Figure 7.4 brings you directly to this part of the sonnets.htm page. HTML for this page isn't shown.

Share ThisShare This

Informit Network