View Full Version : linking to a section of a page through another page?

02-09-2005, 04:56 AM
Okay i have these:

<a href="#1">balh blah</a>

and later

<a name="1"></a>

in my page.

How do i link to the <a name="?"></a> through another page?

02-09-2005, 05:02 AM
<a href="page.html#1">link</a>

... in page.html:

<a id="1">...</a>

It's best to use id instead of name as name is now deprecated.

02-09-2005, 05:28 AM
i can change that no problem.

but, how do i link form page2.html to page1html at the id="1" section in page1.html?

02-09-2005, 05:35 AM
look above you again... :)


<a href="page2.html#one">link</a>


<div id="one">
This is the section of the page you want to link to.

I think I also read somewhere you couldn't use numbers for ids or classes, but I could be very wrong on that... hope this works,

02-09-2005, 05:48 AM
I'll try that out but will need some retooling as the section that needs to linked into is in a table and linking to the div will only bring it into the start of the div. But I'll tool around with it and see whati can come up with.


02-09-2005, 05:51 AM
you can change the "div" to whatever you need. In other words, <a href="page.html#whatever"> will link to whatever element has the id "whatever."

02-09-2005, 05:58 AM
Good thing your on Richard. Sometimes I just need to have things spelled out for me. It only occured to me after reading that and on the can that i can use use a <div...></div>just to define a position in a page. This will be way too easy to implement if they ask for anything that i feel is way too much work otherwise.

Thanks again.