Quite often it is desirable to put a lot of information on a single HTML file with headings for the different parts. For example, on the Campus Web Site is a page of links grouped into various disciplines and interests. You could scroll through the entire page looking for what you want, but HTML provides a way to make a "table of contents" at the top consisting of links which take you to the various headings. Take a look at it and try out some of the links. Use the BACK button to return to the top of that page, and then again to get back to this page.
What we have here is another application of the <A> tag. In this case it is two of them. One is to define an "Anchor" and the other to define the "Anchor Link."
The "Anchor" is placed at the place you want to "link to." The "Anchor Link" is where you want to "link from." Both require some "text" as starting and ending points.
The syntax for an anchor is"
The "Visual Anchor Text" is the text (or graphic) you wish to jump to (that is, have visible) on the page. The "Actual Anchor Text" is not seen by the viewer, but is the NAME of the "Anchor" which the "Anchor Link" will key on when it jumps. This is similar to the ordinary link, where the "address" of the page you are "linking to" is not visible to the person viewing the page, and the "colored underlined text" is the indicator of what to click on to do the "link."
That is not excactly a parallel, since you "jump to" an "Anchor" not "from" as you do in a link, but the idea is similar.
The "Anchor Link" looks alot like a regular link. Its syntax is:
<A HREF="#Actual Anchor Text">Colored, Underlined Text Indicating the Link</A>
When you "click" on an "Anchor Link" the browser will jump down the page and display the "Visual Anchor Text" in the window. If the page is long enough, it will put the "Visual Anchor Text" at the top of the page. If there is not enough room on the page under the "Visual Anchor Text" for it to be moved to the top of the page, it will appear on the screen with the bottom of the page at the bottom of the browser.
It is time for an example. I have been waiting until I got enough on this page to illustrate both situations. By the way, the "Anchor" doesn't have to be below the "Anchor Link" on the page, it can be anywhere on the page.
Example 1:
The text "Exercises 9" at the bottom of this page has been declared the "Visual Text" of an anchor whose "NAME" is "Exercises." The following syntax is used to create an "Anchor Link" to that "Anchor."
Try it:
In this case, the "Exercises 9" appears at the top of the browser window, because there is more than a page of material after it on the page.
Example 2:
The text "Answers" (in quotes) at the very bottom of the page has been designated an "Anchor" with the NAME "Answers." (Yes you can name an anchor the same as the "visible text.")
The syntax is:
In this case the "visible text" of the "Anchor" is not located at the top of the page because there is not enough text below it on the page to move it there.
Notice that the "Anchor Link" is very similar to the ordinary "Link." In this case, instead of a pathway to a different page it uses the "#" to indicate "this is an anchor link." If that were not there, the link would search for a file in the same directory as this page named "Answers," and when it did not find it, would give an error.
Below is that same link, with the "#" left out. Try it.
See! You get an error. By the way, just to complicate matters, you could make the text of the "Anchor Link" an "Anchor" and then make the "Visible Text" of the "Anchor" into the text of an "Anchor Link" so you could jump back and forth between them. I am sure your brain is hurting on that one, so I won't give an example. There will be one for you to do in the exercises.
As you can imagine, it would be nice to be able to have an anchor link to an anchor on a different page. You might like to enable your viewer to jump from the mention of a topic on one page, to a definition, example, or clarification of that topic on another. This is quite easily done, and if you think about ordinary "links" and "anchor links" and the relationship of "links" to files on the same site and others, you can probably figure out the syntax. It is just a combination of the two.
The "anchor" syntax is exactly the same if it is on the same page as the "anchor link" or a different page. For example, the page "OtherLinks.html" in the main directory of this server has the "anchor:"
The "anchor link from this page would look like this:
Try it. You will need to use the BACK button to return here.
Another alternative would be to use the entire "address" of the "WWW Links" page:
Try this one:
OK, that is about it for "Anchors" and "Anchor Links." On to the exercises.
Below is a copy of the Mark Twain speech you formatted in Lesson 4. The exercises here will be to put a variety of "Anchor Links" into this text. Some will be to "Anchors" in the text and others to "Anchors" on other web pages. We needed something that will fill up more than one page of the browser, so you can view the various possibilities.
You will need to open a new HTML file in your text editor, and copy the "code" for the Mark Twain speech into it. I hope this will not be complicated.
If you are using Netscape it appears that if you open the text file in the browser at the address
it will bring up the code. When I tried it in Explorer, it "interpreted" the code. What I suggest is that you open a new browser window and bring up the file using the address above. If it is the code (has the HTML tags visible in it), copy it from the window and paste it in your new HTML file.
If it happens to be "interpreted" (shows the formatting and not the HTML tags) then under the VIEW menu in Netscape is the choice "Page Source" if you select that, you will be able to copy the HTML code for the page from there and paste it in your file. If you are using Explorer, the choice is "Source" and it is also under the VIEW menu.
Now with that taken care of, we can get on with it.
2. Make an "Anchor" at the bold, italic correction, reduction, refutation, or exposure and an "Anchor Link" at the bold moral sand-pile. This is to demonstrate that you can "jump up" on a page as well as "down."
3. This page you are looking at is on newton.uor.edu in the "BasicHTML" directory inside the "Courses" directory. At the bottom of this page (whose name is AnchorLinks.html) is an "Anchor" named "Answers." Create an "Anchor Link" from the bold "I used to be an honest man." in the Twain document on your page to the "Anchor" "Answers" on this page.
4. Now for a mind bender.
From Mark Twain's Speeches (New York: Harper and Brothers, 1910).
At the twenty-fifth anniversary of the founding of Tuskeegee Institute by Booker Washington, Mr. Choate presided, and in introducing Mr. Clemens made fun of him because he made play his work, and that when he worked hardest he did so lying in bed.
I came here in the responsible capacity of policeman to watch Mr. Choate. This is an occasion of grave and serious importance, and it seems necessary for me to be present, so that if he tried to work off any statement that required correction, reduction, refutation, or exposure, there would be a tried friend of the public to protect the house. He has not made one statement whose veracity fails to tally exactly with my own standard. I have never seen a person improve so. This makes me thankful and proud of a country that can produce such men -- two such men. And all in the same country. We can't be with you always; we are passing away, and then -- well, everything will have to stop, I reckon. It is a sad thought. But in spirit I shall still be with you. Choate, too -- if he can.
Every born American among the eighty millions, let his creed or destitution of creed be what it may, is indisputably a Christian to this degree -- that his moral constitution is Christian.
There are two kinds of Christian morals, one private and the other public. These two are so distinct, so unrelated, that they are no more akin to each other than are archangels and politicians. During three hundred and sixty-three days in the year the American citizen is true to his Christian private morals, and keeps undefiled the nation's character at its best and highest; then in the other two days of the year he leaves his Christian private morals at home and carries his Christian public morals to the tax office and the polls, and does the best he can to damage and undo his whole year's faithful and righteous work. Without a blush he will vote for an unclean boss if that boss is his party's Moses, without compunction he will vote against the best man in the whole land if he is on the other ticket. Every year in a number of cities and States he helps put corrupt men in office, whereas if he would but throw away his Christian public morals, and carry his Christian private morals to the polls, he could promptly purify the public service and make the possession of office a high and honorable distinction.
Once a year he lays aside his Christian private morals and hires a ferry-boat and piles up his bonds in a warehouse in New Jersey for three days, and gets out his Christian public morals and goes to the tax office and holds up his hands and swears he wishes he may never-never if he's got a cent in the world, so help him. The next day the list appears in the papers -- a column and a quarter of names, in fine print, and every man in the list a billionaire and member of a couple of churches. I know all those people. I have friendly, social, and criminal relations with the whole lot of them. They never miss a sermon when they are so's to be around, and they never miss swearing-off day, whether they are so's to be around or not.
I used to be an honest man. I am crumbling. No -- I have crumbled. When they assessed me at $75,000 a fortnight ago I went out and tried to borrow the money, and couldn't; then when I found they were letting a whole crop of millionaires live in New York at a third of the price they were charging me I was hurt, I was indignant, and said:
"This is the last feather. I am not going to run this town all by myself."In that moment -- in that memorable moment -- I began to crumble. In fifteen minutes the disintegration was complete. In fifteen minutes I had become just a mere moral sand-pile; and I lifted up my hand along with those seasoned and experienced deacons and swore off every rag of personal property I've got in the world, clear down to cork leg, glass eye, and what is left of my wig.
Those tax officers were moved; they were profoundly moved. They had long been accustomed to seeing hardened old grafters act like that, and they could endure the spectacle; but they were expecting better things of me, a chartered, professional moralist, and they were saddened.
I fell visibly in their respect and esteem, and I should have fallen in my own, except that I had already struck bottom, and there wasn't any place to fall to.
At Tuskeegee they will jump to misleading conclusions from insufficient evidence, along with Doctor Parkhurst, and they will deceive the student with the superstition that no gentleman ever swears.Look at those good millionaires; aren't they gentlemen? Well, they swear. Only once in a year, maybe, but there's enough bulk to it to make up for the lost time. And do they lose anything by it? No, they don't; they save enough in three minutes to support the family seven years. When they swear, do we shudder? No -- unless they say "damn!" Then we do. It shrivels us all up. Yet we ought not to feel so about it, because we all swear -- everybody. Including the ladies. Including Doctor Parkhurst, that strong and brave and excellent citizen, but superficially educated.
For it is not the word that is the sin, it is the spirit back of the word. When an irritated lady says "oh!" the spirit back of it is "damn!" and that is the way it is going to be recorded against her. It always makes me so sorry when I hear a lady swear like that. But if she says "damn," and says it in an amiable, nice way, it isn't going to be recorded at all.
The idea that no gentleman ever swears is all wrong; he can swear and still be a gentleman if he does it in a nice and benevolent and affectionate way. The historian, John Fiske, whom I knew well and loved, was a spotless and most noble and upright Christian gentleman, and yet he swore once. Not exactly that, maybe; still, he -- but I will tell you about it.
One day, when he was deeply immersed in his work, his wife came in, much moved and profoundly distressed, and said:
"I am sorry to disturb you, John, but I must, for this is a serious matter, and needs to be attended to at once."
Then, lamenting, she brought a grave accusation against their little son. She said:
"He has been saying his Aunt Mary is a fool and his Aunt Martha is a damned fool."Mr. Fiske reflected upon the matter a minute, then said:
"Oh, well, it's about the distinction I should make between them myself."
Mr. Washington*, I beg you to convey these teachings to your great and prosperous and most beneficent educational institution, and add them to the prodigal mental and moral riches wherewith you equip your fortunate proteges for the struggle of life.
_________
*Booker T. Washington, founder of the Tuskeegee Institute.
After reading the answers, to put things back the way they were, use the BACK button or scroll down to the link at the bottom of the "Answers" page.