views:

55

answers:

2

I know by reading the W3C documention for HTML4.01 and HTML5 that the "name" attribute originally existed as a property of the <a> tag to permit people to link to an anchor point within a document.

However, now that all major browser venders allow linking to any html element within a document via the "id" attribute, is there still any real use for the "name" attribute? If so, how should I be using the "name" attribute?

+4  A: 

The name attribute is required, I think, on input elements (and their friends)...

<input type="text" name="email" value="" />
alex
To be more specific, the name is used as the key when the form is submitted. It is also how the browser knows which options buttons go with each other so that when one is selected, the others become unselected.
tster
+4  A: 

One thing that comes to mind are radio buttons: you have to use name to specify which ones are part of the same group.

<form>
<input type="radio" name="sex" value="male" /> Male<br />
<input type="radio" name="sex" value="female" /> Female
</form> 
nico