View Full Version : Scrolling links


Kioni
04-11-2006, 04:42 AM
In an effort to keep one of my pages more organized and less chaotic, I'm trying to place various content into sections.

I tried using "http://www.somewhere.com/mydomain/file.htm#gohere" code, but it isn't working. I'm doing something wrong, please help! O_o

_zr_
04-12-2006, 01:22 AM
I'm not sure what exactly you did so I'll just explain the whole page anchors thing;

basically, it's just a link leading to a section on a page (which I'm sure you know).

To Link:
<a href="destination.ext#name">Link</a>

Simple enough. Then where you want that to link on the page you put:

<a name="name"></a>
I think you're technically supposed to end the tag with '...ame" />' instead of </a> but I've personally never had any luck at all with doing it that way.

That should make the link you made previously go to that section of your page.
'name' can be anything you want it to be. But all the anchor names must be different on the same page.

If that is what you're doing and it's still not working, can you post the code?

Kioni
04-12-2006, 01:46 AM
Thank you so much, that's exactly what I was looking for!

Now if only my ipod problem could be sovled this quick Oo;

Kioni
04-12-2006, 02:29 AM
Ok, I seem to be having some trouble with the code. I found the HTML help section for page anchors and that just confused me more.

Where does the <a name="#name"> code come in? It it just another way to do a page anchor or do I have to place that code in with the <a href="destination.ext#name">Link</a> code? Also, what does 'destination' stand for? Do I have to tell the anchor where to go on the page or do I just leave it alone?

G-commer
04-12-2006, 03:19 AM
Hey, do EXACTLY this.
Put this div on your page where you want the page to go to:
<div id="gotoarea"> </div>
And put this link anywhere on your site to go to where you placed the above div on your site:
<a href="#gotoarea">Link</a>

J to the izzosh
04-12-2006, 03:46 AM
There are two parts to the above code: the link and the target.

The target takes the form of an element with a specified ID attribute:
<a id="section_1"></a>
<!-- or... -->
<div id="section_1"></div>

The old way (which still works fine) to do this before the advent of the ID attribute, was to use an <a> element without an href attribute, and assign it a name:
<a name="section_1"></a>

The link takes the form of an anchor element which points to an element on the page (instead of another document) by its name or ID:
<a href="#section_1">Link text.</a>

When a user clicks on the link, their browser will try to focus the top of its window on the top of the element with the name/ID specified by the link.The hash symbol (#) tells the browser that it should be looking for an element instead of another document. It should only be included in front the the name or ID in the link itself, not when you're specifying the name or ID of the other element. You can also link to a specific element in another document by concatenating the location of the document onto the name/ID with hash symbol:
<a href="http://www.website.com/my_other_document.htm#section_1">Section 1 of my other document.</a>

Kioni
04-12-2006, 04:03 AM
Thanks everyone, everything is working now =)