In a page, there are a lot of control elements (or label). In order to more convenient operation these tags, you need to give these label an identity card.

the use of attributes are: name, id, class

1. The name
code is as follows:


<Input type="radio" name='sex'/>Male
<Input type="radio" name='sex'/>Female
3. Quickly get a name the same set of labels: get has the same name tags, operate together, such as: change the properties, events, etc.;

[code] function changtxtcolor () {
var TXTS=document. The getElementsByName (' txtcolor ');//get all the name=txtcolor tag
the for (var I=0; I <TXTS. Length; i++) {//to iterate over the label, and change the background color to red
TXTS [I] style. The backgroundColor='red';

}}

1.3 feature

the value of the name attribute in the current page in the page is not unique.

2. Id


This concludes the body part