Current location - Quotes Website - Personality signature -

1. Different uses:

Name is a form field submission form that is mainly used to obtain information, and is used as tag data of HTML elements that the server can interact with the server, such as

1. Different uses:

Name is a form field submission form that is mainly used to obtain information, and is used as tag data of HTML elements that the server can interact with the server, such as

1. Different uses:

Name is a form field submission form that is mainly used to obtain information, and is used as tag data of HTML elements that the server can interact with the server, such as input, selection, text area, frame element (iframe, window name, used to specify that the target is in other frames or windows), buttons and so on.

and id and class mainly control the styles of elements with id and class set through css.

2. Different usage:

Elements with id defined are selected with id selector "#" in css, for example? < h1 id="center"> My First Heading< /h1> In css, #center{} is used to control its style, and the elements that define class are selected by class selector "."in css.

for example: <; h1 class="center"> My First Heading < /h1> , css uses. center{} to control its style.

Extended materials:

Some notes about ID and Name

Of course, the Name attribute of the HTML element on the page can also act as a small ID, because in the DHTML object tree, we can use documents. Gets the getElementsByName of the page containing an array of all the specified object name elements.

2. if n(n> 1) What if there are two HTML elements with the same ID? How to reference them in DHTML objects? If we use ASPX pages, this is unlikely to happen, because the aspnet process is not allowed to handle ASPX pages with different ids, so an exception will be thrown and the page will not be rendered correctly.

3. For dynamic pages, what if we insist that I repeat that IE? At this point, we can still use document. Getelementbyid to get the object, but we can only get the object whose ID is duplicated in the first object that appears in the HTML presentation.

At this time, the duplicate id will automatically become an array when referenced, and the elements with duplicate ID will exist in the array in the order of rendering.