W3cschool JavaScript Learning

Source: Internet
Author: User
Tags html form
Name differs from ID attribute
1, we know that when the Web page to do post submission, is the form (that is, form field) for the submission of units, a form has several form objects (such as <input type= "text" name= "UserName" value= "Please enter the name"/>) , the same page can be more than one form (ASP., it only allows one, and the name must be Form1), after the table single table submitted to the server side, you can directly through the Name property to the value of the form field, but not through the ID directly to the value of the Table Form object.
2. There cannot be more than one HTML tag with the same name attribute in the same form, but if there is more than one form in a Web page, a different form can have the same name attribute tag. While the ID is global, you cannot have multiple nodes in an HTML document using the same ID, regardless of which form it is in.
3, when creating a CSS style, you can create an ID style sheet (prefixed with #), so that the style with the ID directly apply the style, and cannot establish the name style sheet.
4, it is recommended to use the ID to identify a node when making a Web page edit, instead of using name (unless it is required for post submission), the getElementById method is recommended when using JavaScript for DOM node positioning, because only the ID uniquely identifies a node , and there may be multiple nodes with the same name attribute in the same page, which are in separate form.


HTML form
Http://www.w3school.com.cn/tags/tag_form.asp

W3cschool JavaScript Learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.