PDA

View Full Version : Linking to an #ID on a different page.




Greenhoe
Feb 9, 2009, 06:29 PM
Hi,
I wanted to know if it is possible to link to a specific #ID that is on another page.

Such as...
Link from page 1, to an ID on page 2.

If this is possible how do I make the link? Thanks

Thanks



r.j.s
Feb 9, 2009, 06:31 PM
I think you have to give it an anchor, not an id.

Greenhoe
Feb 9, 2009, 06:36 PM
I think you have to give it an anchor, not an id.

How exactly do I do that? I'm not familiar with anchors at all. Is it similar to an ID? As I have a ID in a DIV on another page which I'm trying to link to.

r.j.s
Feb 9, 2009, 06:39 PM
Use <a name="div1"></a> right before the div you want to link to.

Then for the link use: <a href="page.htm#div1">Link</a>

Replace div1 with whatever name you want.

angelwatt
Feb 9, 2009, 07:12 PM
The id attribute will generally work as well. There might be some old browsers that don't understand it, but can't remember specifics.

page.html:
<a href="somepage.html#idName">Link to id on some other page</a>
somepage.html:
<div id="idName">