' HTML5 ' form properties

Source: Internet
Author: User

* AutoComplete

The AutoComplete property specifies that the form or input field should have auto-complete functionality.

Note: AutoComplete applies to <form> tags, as well as the following types of <input> tags: text, search, URL, telephone, email, password, datepickers, R Ange and color.

When the user starts typing in the AutoComplete field, the browser should display the fill-in options in that field:

<!DOCTYPE HTML><HTML><Body><formAction= "/example/html5/demo_form.asp"Method= "Get"AutoComplete= "On">First name:<inputtype= "text"name= "FName" /><BR/>Last Name:<inputtype= "text"name= "LName" /><BR/>e-mail:<inputtype= "Email"name= "Email"AutoComplete= "Off" /><BR/><inputtype= "Submit" /></form><P>Please fill in and submit this form, and then reload the page to see how AutoComplete works.</P><P>Note that the AutoComplete feature of the form is turned on, and the e-mail domain is turned off.</P></Body></HTML>

* Autofocus

The Autofocus property specifies that the domain automatically receives focus when the page loads.

Note: The Autofocus property applies to all <input> label types.

<!DOCTYPE HTML><HTML><Body><formAction= "/example/html5/demo_form.asp"Method= "Get">User Name:<inputtype= "text"name= "user_name"Autofocus= "Autofocus" /><inputtype= "Submit" /></form></Body></HTML>

* Form

The form property specifies one or more forms to which the input domain belongs.

Note: The form property applies to all <input> label types.

The Form property must refer to the ID of the owning form:

If you want to refer to more than one form, use a space-delimited list.

<!DOCTYPE HTML><HTML><Body><formAction= "/example/html5/demo_form.asp"Method= "Get"ID= "User_form">First name:<inputtype= "text"name= "FName" /><inputtype= "Submit" /></form><P>The following input fields are outside the form element, but are still part of the form.</P>Last Name:<inputtype= "text"name= "LName"form= "User_form" /></Body></HTML>

* List

The List property specifies the DataList of the input domain. DataList is a list of options for the input domain.

Note: The List property applies to the following types of <input> tags: text, search, URL, telephone, email, date pickers, number, range, and color.

<!DOCTYPE HTML><HTML><Body><formAction= "/example/html5/demo_form.asp"Method= "Get">webpage:<inputtype= "url"List= "Url_list"name= "link" /><DataListID= "Url_list">    <optionlabel= "W3school"value= "http://www.w3school.com.cn" />    <optionlabel= "Google"value= "http://www.google.com" />    <optionlabel= "Microsoft"value= "http://www.microsoft.com" /></DataList><inputtype= "Submit" /></form></Body></HTML>

* max, Min, step

The Min, max, and step properties are used to specify a qualification (constraint) for input types that contain numbers or dates.

The Max property specifies the maximum allowable value for the input field.

The Min property specifies the minimum allowable value for the input field.

The Step property specifies a valid number interval for the input field (if step= "3", the legal number is -3,0,3,6, etc.).

Note: the Min, Max, and step properties apply to the following types of <input> tags: date pickers, number, and range.

The following example shows a numeric field that accepts a value between 0 and 10 with a stepping of 3 (that is, a valid value of 0, 3, 6, and 9):

<!DOCTYPE HTML><HTML><Body><formAction= "/example/html5/demo_form.asp"Method= "Get">Points:<inputtype= "Number"name= "Points"min= "0"Max= "Ten"Step= "3"/><inputtype= "Submit" /></form></Body></HTML>

* Multiple

The Multiple property specifies that multiple values can be selected in the input field.

Note: The Multiple property applies to the following types of <input> tags: email and file.

<!DOCTYPE HTML><HTML><Body><formAction= "/example/html5/demo_form.asp"Method= "Get">Select Images:<inputtype= "File"name= "img"multiple= "multiple" /><inputtype= "Submit" /></form><P>When you browse for a file, try selecting multiple files.</P></Body></HTML>

* Placeholder

The placeholder property provides a hint (hint) describing the value that the input field expects.

Note: The placeholder property applies to the following types of <input> tags: text, search, URL, telephone, email, and password.

The hint (hint) appears when the input field is empty and disappears when the input field gets focus:

<!DOCTYPE HTML><HTML><Body><formAction= "/example/html5/demo_form.asp"Method= "Get"><inputtype= "Search"name= "User_search"placeholder= "Search w3school" /><inputtype= "Submit" /></form></Body></HTML>

* Required

The Required property specifies that the input field must be filled in before submission (cannot be empty).

Note: The Required property applies to the following types of <input> tags: text, search, URL, telephone, email, password, date pickers, number, checkbox, Rad Io and file.

<!DOCTYPE HTML><HTML><Body><formAction= "/example/html5/demo_form.asp"Method= "Get">Name:<inputtype= "text"name= "Usr_name"Required= "Required" /><inputtype= "Submit" /></form></Body></HTML>

' HTML5 ' form properties

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.