<a name="xyz"/> 'obsolete'?

G

Guest

The editor says that when using <a name="xyz" />, the "name" element is
"obsolete" but it doesn't suggest a replacement. What's wrong with <a
name="xyz" /> to set a page anchor?
 
G

Guest

That's correct; in XHTML the name attribute of the anchor is obsolete.
Preference is to now reference a page anchor by an element's ID attribute.

I.e. <div id="xyz">...some content</div> would work with the "#xyz" in the
URL the same as the <a name="xyz" /> did in older HTML versions.

- Steve
 
S

Steven Cheng[MSFT]

Hi Alex,

As Steve has said, ASP.NET 2.0/vs 2005 by default use XHTML (transitional)
to validate the aspx content and "name" attribute is no longer an valid
attribute in XHTML(transitional). We should use "id" attribute instead. And
most popular browsers has already begun support xhtml pages. And here is a
good msdn reference on XHTML and othe web standards support in ASP.NET
2.0/VS 2005:

#Building ASP.NET 2.0 Web Sites Using Web Standards
#http://msdn.microsoft.com/asp.net/reference/infrastructure/default.aspx/def
ault.aspx?pull=/library/en-us/dnaspp/html/aspnetusstan.asp

Hope this also helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
G

Guest

Okay, and I like that idea quite a bit anyway - but my question is this: If I
do it using element IDs, can I do hyperlinks and JavaScript scrolling that
references those spots on the page using the old URL approach:
href="xyz.aspx#ElementID"???

Alex
 
M

MSDN

Yes, Target an Id and it will take you there.

I have targeted a Table ID for example and it worked.

SA
 
S

Steven Cheng[MSFT]

Thanks for SA's input,

Hi Alex,

For anchor used in url, you can just use the "id" value to replace the
original "name" value, e.g;

http://server/app/page1.aspx#anchorid1

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top