|
Posted by Steve Pugh on 11/02/71 11:39
marcwentink@hotmail.com wrote:
> The person who wrote it just assumed it should have a name and an id.
> The id is used, the name not. But why should td have an id, but not a
> name? Why is there a name and also an id attribute anyway?
name was used in earlier versions of HTML for a selection of different
purposes. Look at the attributes index for HTML 4 and you see that
there are 11 different definitions for the name attribute depending on
which element it is used on.
http://www.w3.org/TR/html401/index/attributes.html
So from HTML 4 onwards, the id attribute is used to uniquely identify
an element for the purposes of scripting and linking; and the name
attribute is only really used for form elements now.
> The only reason I can find is that some elements have one name, and a
> few sort of subelements, by id. And then you can use:
> getElementsByName, note the plurial "Elements".
Yep, radio buttons are the classic example. A group of radio must have
the same name, but each individual radio button can have a unique id as
well.
Steve
Navigation:
[Reply to this message]
|