HTML Forms Process User input

Source: Internet
Author: User

The 1.HTML form is used to collect user input. Defined by <form> </form> tags

The 2.<input> element is the most important text element.

2.1.text Define general text input, password define password field

<form>User Name:<BR><inputtype= "text"name= "userid"><BR>User Password:<BR><inputtype= "Password"name= "PSW"></form>

2.2.radio define radio button input, checkbox definition check box

<form><inputtype= "Radio"name= "Sex"value= "Male"checked>Male<BR><inputtype= "Radio"name= "Sex"value= "female">Female</form><form><inputtype= "checkbox"name= "Vehicle"value= "Bike">I have a bike<BR><inputtype= "checkbox"name= "Vehicle"value= "Car">I have a car</form

2.3.submit Define submit button (Submit form)

<action= "/demo/demo_form.asp"  method= "GET"> <  type= "Submit  " value= "Submit"></ form >

The Action property defines the action that is performed when the form is submitted. A server script is specified to process the submitted form
The method property specifies the HTTP methods (GET or POST) that are used when the form is submitted
GET (Default method): Applies to no sensitive information. Less form data (the form data is visible in the page's address bar)

2.4.<input type= "Number" > is used for input fields that should contain numeric values.

< form > Quantity: <  type= "number"  name= "points"  min= "0"  Max  = "+" step= "Ten " value= ">"< /form>

2.5.<input type= "Date" > is used for input fields that should contain dates. (Month,week,time)

< form > Birthday: <  type= "date"  name= "bday"></form  >

2.6.<input type= "COLOR" > for input fields that should contain colors.

2.7.<input type= "Range" > is used for input fields that should contain values within a certain range.

< form > <  type= "range"  name= "points"  min= "0"  Max  = "Ten"></form>

2.8.<input type= "Email" > for input fields that should contain e-mail addresses.
2.9.<input type= "Search" > For search Fields (the search field behaves like a regular text field).

3.<select> element drop-down list

<Selectname= "Cars"><optionvalue= "Volvo">Volvo</option><optionvalue= "Saab">Saab</option><optionvalue= "Fiat">Fiat</option><optionvalue= "Audi">Audi</option></Select>

4.<button> elements Define clickable buttons

<type= "button"  onclick= "alert (' Hello world! ')" > Click me! </ Button >


5.Input Properties
The Value property specifies the initial value of the input field
The ReadOnly attribute specifies that the input field is read-only (cannot be modified)
The disabled attribute specifies that the input field is disabled
The Size property specifies the dimension of the input field (in characters counted)

HTML form handles user input

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.