The role of name in CSS: assign a name to the current tag or element.
Name was originally used for identification, but now according to the specification, it is recommended to use id to identify elements.
Only name can be used in the following:
1. The name of the control in the form, and the submitted data is controlled by the name of the control instead of the id. Because there are many names that correspond to multiple controls at the same time, such as checkbox and radio, and the ID must be unique in the entire document. In addition, the browser will set the request sent to the server based on the name. Therefore, if you use id, the server cannot get the data.
2. The names of frame and window are used to specify targets in other frames or windows.
Only id can be used for the following:
1. The association between label and form control,
the for attribute specifies the id of the element associated with label, name cannot be used substitute.
2. The element selection mechanism of CSS uses #MyId to specify the element to which the style should be applied, and cannot be replaced by name.
3. Obtain the object in the script: