@Ice3TauthorApr 08.2003 — #I dont know what a NodeList is so I dont understand much about getElementsByName
But if I understand correctly I can give an object a name or an ID and will get the same effect also if I use an ID I can refer to that object using document.getElementById(objectsID).
I dont really see how that is usefull since getElementById is such a long comand name to type.
If I have a type=text input, ID=[b]text1[/b] in a form ID=[b]form1[/b] I could refer to its value as:
document.text1.form1.value //in this case it doesnt matter if its an ID or name
or
document.getElementById('text1').value //in this case it must be an ID
other than this is there a compatibility issue with Netscape?
@gil_davisApr 08.2003 — #The NAME attribute is used for forms, images, anchors and navigation. When you want to do navigation within the page, you can specify # and the desired NAME value in the link to navigate to that spot.
There can be more than one object with the same name. This is helpful in forms where you have an array of checkboxes with the same name but different values. When the form is submitted, the only box submitted is the one checked, but regardless of which one is checked, the same name is passed (e.g.: ?someName=someValue).
An ID must be unique. You cannot have more than one object with the same ID. For backward compatibility, if no NAME is specified, the browser will take the ID and copy it into the NAME attribute for you.
You can specify styles by an ID, but not a NAME.<style> #someID {color: red} </style>As a general rule, use the property as intended and you will fare well. Think of an ID as a social security number or driver's licence - one per customer, but anyone can have the same name as yours.