Forum Moderators: open

Message Too Old, No Replies

Help with named anchor tags

Shouldn't they work even when the target is within a table?

         

budbiss

2:49 pm on Oct 19, 2004 (gmt 0)

10+ Year Member



I have five links on a page that I would like to have linked to specific positions (the target pages position depending on what link is clicked) on another page. The page I am linking to is a big table, I have the anchor 'name' tags placed within the table. Is this why it is not working? Do anchor tags not work when they are within a table?

webmasterguy

3:34 pm on Oct 19, 2004 (gmt 0)

10+ Year Member



Have you added the fragment identifier to the area you want to link to?

for example <H2><A HREF="chapter2.htm" NAME="chapter2">chapter 2 </A></H2>

photon

3:50 pm on Oct 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you validated [validator.w3.org] your code?

budbiss

4:20 pm on Oct 19, 2004 (gmt 0)

10+ Year Member



webmasterguy-
What is the fragment identifier? Is that the 'name' tag on the target?

Basically I have this:
(page 1)
<html>
<a href=http://www.someurl.com#test4>Click here to see bla bla bla on the next page</a>
</html>

(page 2)
<html>
<a name=test4>bla bla bla</a>
</html>

webmasterguy

4:44 pm on Oct 19, 2004 (gmt 0)

10+ Year Member



Appologies I didn't explain clearly in the example I gave above.

The fragment identifier is a string after URI, after the hash, which identifies something specific as a function of the document. For example in the object

[widget...]

the string "frag" is the fragment identifier. It is badly named, as it can identify anything.

To ensure that this internal linking works properly, add the fragment identifiers to the file for each location you wish to jump to.

Example as given before
<H2><A HREF="location">Location</a></H2>

Because the text already is contained in an anchor element, use the Name= attribute to name the fragment.

<H2><A HREF="location" NAME="location">Location</a></H2>

You can find out more information on fragment identifiers here
[w3.org...]

[edited by: webmasterguy at 5:12 pm (utc) on Oct. 19, 2004]

photon

4:54 pm on Oct 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is a longshot, but have you tried putting the name is quotes?

<a name="test4">bla bla bla</a>

budbiss

6:08 pm on Oct 19, 2004 (gmt 0)

10+ Year Member



Thanks guys, I will try out your suggestions ASAP and let you know what happens.

budbiss

12:51 am on Oct 20, 2004 (gmt 0)

10+ Year Member



I tried your suggestions, but no luck. Any other ideas guys?

tedster

12:55 am on Oct 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Browsers will often scroll just to the top of a table for a named anchor somewhere within the table.

I have this issue myself on a pretty extensive calendar page. My solution was to break the one big table into several other tables (month by month, not season by season or year by year) so I could place the named anchors at the top of a "dedicated" table instead of within it.

budbiss

1:01 am on Oct 20, 2004 (gmt 0)

10+ Year Member



OK, it works fine when the <a> tag is outside of the table, but when it is inside of it, ie doens't acknowledge it (firefox does though btw). Is there any way to get ie to recognize the <a> tag inside a table?

tedster

2:39 am on Oct 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think IE does recognize the anchor - it just acts as if "the entire table" is what is being named, and it takes you to the top of the table where the anchor is. So multiple anchors within the same table all go to the same place - the top of that table.

A least that is the only behavior I ever could get. But there is an advantage here - breaking up one long table into many tables that follow each otherdown the page has the advantage of rendering some content in the visible window, faster.

tribaljohn

2:44 am on Nov 27, 2004 (gmt 0)


did you try using the <ID> tag with <SPAN ID="somename">Some Name</SPAN>