View Full Version : Place in document

12-21-2009, 10:57 PM
Hey guys,

I've never understood how this is done:

I know that #top means to go to the top of a document - how do i use them to go to certain parts of the document?

Eg: If I have a calendar like this:

Jan 1
Jan 2
Jan 3
Jan 4
Jan 5

and I want to skip to Jan 5 in the document - how do you go there by hyperlinking <a href="index.html#jan5">Jan 5</a>

I hope you know what I mean. Also - Merry Christmas :)


12-22-2009, 12:06 AM
<a href="#link">Clicking this jumps to</a>

<a name="link">here..</a>

12-22-2009, 12:14 AM
I think you are talking about the name attribute. From - http://www.w3schools.com/HTML/html_links.asp

The name Attribute

When the name attribute is used, the <a> element defines a named anchor inside a HTML document.

Named anchor are not displayed in any special way. They are invisible to the reader.

Named anchor syntax:
<a name="label">Any content</a>

The link syntax to a named anchor:
<a href="#label">Any content</a>

The # in the href attribute defines a link to a named anchor.

So using your example you would use this at the January 5th location on the calendar. <a name="jan5">Jan 5 content</a>. [I have also used this without putting any content - like this <a name="jan5"></a> at the beginning of the line where I want the jump to go, but do not know if that is kosher.]

And then at the part of your document where you want to list the dates and have the ability to jump to that section you would have <a href="#jan5">January 5</a>.

The W3schools page has other examples such as how to link from another page to that place in the document, etc.