Named anchors don't work

B

Bill Mullen

I just noticed that named anchors don't work for external files.

Here is a sample

filename: testanchors.php
....
<body>
<a name="somename"></a>
Some text goes here...
....
</body>
....


filename: testfile.php
....
<body>
....
<a href="testanchors.php#somename">Click here</a> to test.
....
</body>
....

I test my pages in Opera, Netscape, Safari, Firefox, and IE6 and IE7.
The only browsers that don't work are IE6 and IE7.

I recently changed to XHTML 1.0 transitional. I made certain the page
validated at http://validator.w3.org/ and it did, so I know the code
is correct.

I made a couple of changes to get it working but I am really baffled
as to why it didn't work using the above code as it should have.

Bill
 
F

Frank Saunders, MS-MVP OE/WM

Bill Mullen said:
I just noticed that named anchors don't work for external files.

I test my pages in Opera, Netscape, Safari, Firefox, and IE6 and IE7.
The only browsers that don't work are IE6 and IE7.

I recently changed to XHTML 1.0 transitional. I made certain the page
validated at http://validator.w3.org/ and it did, so I know the code
is correct.

I made a couple of changes to get it working but I am really baffled
as to why it didn't work using the above code as it should have.


I no longer have a machine with IE6, but my up-to-date IE7 WinXP and Vista
machines go to named anchors. I can remember them not doing that, but I
don't know which update fixed it.
 
B

Bill Mullen


I fixed my pages by moving the name to another anchor. Here was my
original code that did not work.

<a name="070402"></a>
<a class="HeadingPink" href="puppypage.php?Puppy=070402">Airabella
("Baby Bella")</a>

Here is the new code that does work:

<a name="070402" class="HeadingPink"
href="puppypage.php?Puppy=070402">Airabella ("Baby Bella")</a>


The reason I did this is because I read an article that said another
system had problems with empty anchor tags.

I have not tried the following but I might:

<!-- Named anchor with href pointing to itself -->
<a name="070402" href="adoptions.php#070402"></a>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top