HTML form and the input end of the route based learning, learning

Forms

Form a region comprising a form element.

Form element in a form that allows a user (for example: text fields, drop-down lists, radio buttons, check boxes, etc.) to input information elements.

Form using the form tag (<form>) is defined.

<form>
...
  input 元素
...
</form>

Entry

Form tag to be used in most cases is the input tag (<input>). The input type is defined by the type attribute (type). Most frequently used input types are as follows:

1) Text field (Text Fields)

When the user to type letters, numbers, and other content in the form, it will use the text field.

<form>
First name: 
<input type="text" name="firstname" />
<br />
Last name: 
<input type="text" name="lastname" />
</form>

The browser displays the following:

First name:  
Last name: 

Note: The form itself is not visible. Meanwhile, in most browsers, the default width of the text field is 20 characters.

2) radio button (Radio Buttons)

When the user select from a number of select whichever given moment, it will use radio buttons.

<form>
<input type="radio" name="sex" value="male" /> Male
<br />
<input type="radio" name="sex" value="female" /> Female
</form>

The browser displays the following:

 Male 
 Female

Note: You can only select from one.

3) check boxes (Checkboxes)

When the user needs to select one or several options from a plurality of given selection, the box will be used.

<form>
<input type="checkbox" name="bike" />
I have a bike
<br />
<input type="checkbox" name="car" />
I have a car
</form>

The browser displays the following:

 I have a bike 
 I have a car

Form action attribute (Action), and an OK button

When the user clicks the OK button, the contents of the form will be sent to another file. The form action attribute defines the file name of the destination file. By the action attribute definition file normally be received input data related to a process.

<form name="input" action="" method="get">
Username: 
<input type="text" name="user" />
<input type="submit" value="Submit" />
</form>

The browser displays the following: a new front-end learning qun438905713, most in the group are zero-based learners, we help each other, answer each other, and also to prepare a lot of learning materials, welcomed the zero-based junior partner to the exchange.

Username:  

Form tag

label description
<form> Form definition for user input
<input> Define the input field
<textarea> Defined text field (a multi-line input control)
<label> Tag defines a control
<fieldset> Domain
<legend> Title of domain
<select> Define a select list
<optgroup> Defined set of options
<option> Defined drop-down list of options
<button> The definition of a button
<isindex> Has been abandoned, the <input>
Published 39 original articles · won praise 21 · views 20000 +

Guess you like

Origin blog.csdn.net/webxuexi168/article/details/104318732