Named anchors don't work

  • Thread starter Thread starter Bill Mullen
  • Start date Start date
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
 
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.
 

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>
 
Back
Top