Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2009
    Location
    UK
    Posts
    56
    Thanks
    5
    Thanked 1 Time in 1 Post

    Place in document

    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

    Cheers,
    James

  • #2
    met
    met is offline
    Regular Coder
    Join Date
    Oct 2009
    Location
    United Kingdom
    Posts
    728
    Thanks
    4
    Thanked 119 Times in 119 Posts
    Code:
    <a href="#link">Clicking this jumps to</a> 
    
    
    
    
    
    
    
    
    
    <a name="link">here..</a>

  • #3
    New Coder
    Join Date
    Dec 2009
    Posts
    11
    Thanks
    0
    Thanked 1 Time in 1 Post

    link in document

    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.

    Weaver


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •