The term "same namespace"
means that names and ids are not completely separate. You can use the same name
and id
on one particular object, but you cannot use name="foo"
on one object and id="foo"
on another object. That creates a conflict.
It's just the way those browsers decided to implement things. There's also a global variable for each element with an id that contains the dom element. That's just the way they implemented things. It wasn't standard, it isn't the way things are done in more modern browsers (except for some backward compatibility).
Use id
values for any DOM elements you want to retrieve. Use name
values for server identification in posted forms.
Your code will have no conflicts between names and ids if you don't use an id
on one object and the same name
on another object, and there generally isn't an issue with giving a particular element the same name
and id
.