Avatar of Sue White
Sue WhiteFlag for United States of America

asked on 

HREF link anchor name vs id

I needed to do some troubleshooting for some anchors tags that stopped working in Internet Explorer (6 or 7). It appeared that IE was stripping the hash (#) mark out of the url - but this did not happen with Firefox.  I started searching for information that led me to believe that <a name> has been deprecated and the <id> attribute was now the preferred way to create anchor tags.

Can the Experts shed some light on whether anchor tags should include both name and id?  And what the link syntax should look like?

Both links on this page should both pop you down to the anchor, but only the hash link works this way.
http://www.awwarf.org/siteMap/test2.htm




hyperlinks on http://www.awwarf.org/siteMap/test.htm
 
<a href="http://www.awwarf.org/siteMap/test.htm" id="order">site tour id link</A>.<br>
<a href="http://www.awwarf.org/siteMap/test.htm#order">hash link</a>
 
 
named anchor and id on page: http://www.awwarf.org/siteMap/test.htm
 
<table width="750" border="1" cellspacing="2" cellpadding="2">
  <tr>
    <td>Order Reports<a name="order" id="order"></a></td>
    <td>&nbsp;</td>
  </tr>		
</table>

Open in new window

Web BrowsersHTML

Avatar of undefined
Last Comment
Sue White
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Sue White
Sue White
Flag of United States of America image

ASKER

On my landing page, I have this:
Order Reports

My hash link works, but my id link does not.   Is my syntax not correct for the ID link?  
Avatar of TName
TName

>My hash link works, but my id link does not.   Is my syntax not correct for the ID link?

---

Why should it work? The id is in no way part of the href. You are assigning the *link* the id "order" and you tell it to go to the"test.html" page (without specifing where on "test.html" it should jump to).
Again, id="order" here assigns an id to the link. And if both (link and the cell with the id "order" are on the same page, you will have multiple objects with the same id, which shouldn't be).
<a href="http://www.awwarf.org/siteMap/test.htm" id="order">site tour id link</A>.

Open in new window

Avatar of Sue White
Sue White
Flag of United States of America image

ASKER

I'm sorry, I have a typo in my original post.  The link is on this page http://www.awwarf.org/siteMap/test2.htm and the anchored cell is on this page, http://www.awwarf.org/siteMap/test.htm, so this is not the case, ()

My logic for creating the html link to the id was to do the same as I do for a hash - but it sounds like this assigns the id to the link ???   so how would you create a link from test2.htm to the ID anchor on test.htm?
SOLUTION
Avatar of TName
TName

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of Sue White
Sue White
Flag of United States of America image

ASKER

I did some more digging.  I was incorrect about a name being deprecated as I am using it with links.  I will use name and forget about it.  Splitting the points to thank you for taking the time to respond.
HTML
HTML

HTML (HyperText Markup Language) is the main markup language for creating web pages and other information to be displayed in a web browser, providing both the structure and content for what is sent from a web server through the use of tags. The current implementation of the HTML specification is HTML5.

62K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo