Results 1 to 6 of 6

Thread: Jump to line of text

  1. #1
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Jump to line of text

    Hi, I have the code to jump to the top or bottom of a page or doc. but can somebody tell me how to do the code and tags/anchors to jump to one particular area of text on a large page. Do I use just one of these or do I need 2 of them together? What do I put in the first document and what goes in the second?
    http://www.w3schools.com/html/html_links.asp Thanks in advance.
    Last edited by stillatlarge; 10-02-2006 at 01:47 AM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,023
    Thanks
    44
    Thanked 3,209 Times in 3,171 Posts
    Blog Entries
    12

    Default

    In HTML this is done with named anchors and links to those anchors. Place a named anchor near where you want to jump to in the page:

    HTML Code:
    <a name="aboutus"></a>
    The name can be any valid HTML name but, it must be unique. Then you can jump to that section on the page using (let's say this is your index.html):

    HTML Code:
    <a href="index.html#aboutus">About Us</a>
    That will work on the page itself or from another page. On the page itself, you can also use this shorthand:

    HTML Code:
    <a href="#aboutus">About Us</a>
    Notes: Named anchors can have lass than satisfactory results if there isn't enough other content on the page to make a jump to that anchor much different than loading the page in the ordinary manner.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    An anchor usually jumps to the text and puts it to the top of the page (if there is enough content), which makes it, as John already said, unable to keep it's consistency.
    - Mike

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    Note that the ancher (and link) can go wherever you want. It can be at the top, bottom, or anywhere else in the content of your page... in text, etc. (I'd say, just to keep the code from being messy, to keep it after/before a line of text, etc.)
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok, I tried but it doesn't work. How do I get it to jump from a text link on a website to a line of text on ANOTHER site? I want to take the reader from a line on my website to a thread on a forum like this. Is it possible? I know I have to have the url of the site I'm jumping to in there somewhere on the first site but where in the code does it go? Thanx.
    Last edited by stillatlarge; 12-10-2006 at 12:04 AM.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,023
    Thanks
    44
    Thanked 3,209 Times in 3,171 Posts
    Blog Entries
    12

    Default

    You mentioned the W3Schools page:

    http://www.w3schools.com/html/html_links.asp

    Go back and study it again, particularly this section:

    The Anchor Tag and the Name Attribute

    Also, have a look at their working example of this:

    http://www.w3schools.com/html/tryit....link_locations
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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