HTML knowledge point summary form elements and html knowledge point forms

Source: Internet
Author: User

HTML knowledge point summary form elements and html knowledge point forms

Web pages cannot be purely static without any interaction functions. Most websites use form elements. The form provides a way for the visitor to interact with the website, such as user registration and logon, user message, and other functions.

  • Form

The form element is only a container for retrieving data elements, and the elements in the container are called form Controls. To enable the submission of form data, you can enclose form elements in <form>. The most common form control is the input element. The form element is a block-level element.

  • Main attributes of form

Name attribute: Specifies the form name.

Action attribute: Specifies the page on which the form Element Data is submitted.

Method attribute: Specifies the method in which form data is submitted. The values are as follows:

(1) get: the default value. It is transmitted through url and cannot exceed 1 k at the maximum. The security is not very good.

(2) post: there is no limit on the size of the transmission, and the security is good, not transmitted through the url.

Novalidate attribute: it is a new attribute added by html5. it is required not to be verified when a form is submitted.

Autocomplete attribute: This attribute is added to html5. it specifies whether the Automatic completion function should be enabled for the form. When you start typing a field, the browser displays the entered options in the field based on the previously typed value.

  • Input

Input is a powerful form control. Its main attributes include:

Text defines the input fields of a single line. You can enter text in it.

Password defines the password field. The character mask in this field

File defines the input fields and the "Browse" button for file upload.

Radio definition radio button

Checkbox definition check box

Hidden defines hidden input fields

Button definition clickable button (in most cases, it is used to start the script through JavaScript)

Image definition image form submission button

Reset defines the reset button. The reset button clears all data in the form.

Submit defines the submit button. The submit button sends the form data to the server.

 

Date defines the input fields of the selected day, month, and year.
Month defines the input fields of the selected month and year.

Time defines the input fields of the selected month and year.

  • Select drop-down list

The drop-down list is generated by using the <select> and <option> labels. The drop-down menu item is defined by the <option> label. When a form is submitted, the value Attribute value of the selected option is sent.

<Select> A tag has two important attributes:

(1) multiple: it is required that you can select multiple items from the select drop-down menu. By default, only one item can be selected from the drop-down list.

(2) size: specifies the number of items visible to the list after the drop-down list is expanded.

 

Related Article

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.