Log in

View Full Version : Jump to line of text



stillatlarge
10-02-2006, 01:34 AM
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.

jscheuer1
10-02-2006, 02:29 AM
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:


<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):


<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:


<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.

mburt
10-02-2006, 10:22 AM
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.

djr33
10-02-2006, 11:16 AM
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.)

stillatlarge
12-10-2006, 12:58 AM
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.

jscheuer1
12-10-2006, 05:08 AM
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.asp?filename=tryhtml_link_locations