+1  A: 

I believe the proper way to do it is <a id="one">

OverloadUT
+7  A: 

name attributes are deprecated in XHTML 1.0 - you can use an id attribute in the same way though, see Fragment Identifiers in the HTML Compatibility Guidelines of the XHTML spec.

So you can simply use

<h2><a id="one">Section One</a></h2>

But note that the 1.0 spec recommends playing it safe with something like this:

<h2><a name="one" id="one">Section One</a></h2>

However, your fragment uses XHTML 1.1, where the name attribute has been entirely removed from a and map elements - so you can only use an id.

Paul Dixon
Actually, the fragment in the question is XHTML 1.1, which means that `name` is not just deprecated, it's plain illegal.
Jörg W Mittag
Well spotted, I missed that he was using 1.1 - will amend answer
Paul Dixon
I'm assuming 1.1 still has the name attribute for the input tag, though... I don't have time to check it at the moment.
R. Bemrose
I should explain why I assume it still have the name attribute for input: radio buttons all have the same name, and checkboxes are also allowed to have the same name to have their values grouped together.
R. Bemrose
sorry, yes I overstated - it's removed from a and map tags
Paul Dixon
+2  A: 

I believe the modern approach is to use the id attribute, which would be evaluated as an anchor. For example, if you changed

<h2><a name="one">Section One</a></h2>

to

<h2><a id="one">Section One</a></h2>

You would still address it as page.html#one.

sblundy
+5  A: 

You should use the id attribute instead. Works the same way, and you don't need an artifical <a name=...>, but simply

<h2 id="one">Section One</h2>
phihag
+1  A: 

Yes it is outdated. You should replace with the "id" attribute.

Quoting w3schools page:

"The id Attribute Replaces The name Attribute HTML 4.01 defines a name attribute for the elements a, applet, frame, iframe, img, and map. In XHTML the name attribute is deprecated. Use id instead."

http://www.w3schools.com/Xhtml/xhtml_syntax.asp

rogeriopvl
+1  A: 

You can also link on a section header :

Table of Contents

<P>
    <A href="#section1">Introduction</A><BR>
    <A href="#section2">Some background</A><BR>
    <A href="#section2.1">On a more personal note</A><BR>
    ...the rest of the table of contents...
    ...the document body...

    <H2 id="section1">Introduction</H2>
    ...section 1...

    <H2 id="section2">Some background</H2>
    ...section 2...

    <H3 id="section2.1">On a more personal note</H3>
    ...section 2.1...

[...]
</P>

Source: http://www.w3.org/TR/REC-html40/struct/links.html

jfrobishow
A: 

name= attributes are for labeling elements in a form, and can only be used on <form> elements (input, textarea, select etc). For everything else, ID= is used. Exactly why the W3C folks thought two different ways of naming an element (with different sets of allowable characters) were needed is not readily known.

James Curran