Form _HTML

HTML form input elements _

  • Most cases are used form tag is the input label
  • The input type is defined by the type attribute (type).

Common types are as follows:

Text fields (Test Fields)

Text field byLabel set, when the user to type letters, numbers, and other content in a form, the text field will be used. Text field for the one-line text boxes, the effect is as follows:

<form>
account_ : <input type="text" name="firstname"><br>
password: <input type="password" name="lastname">
</form> 
account_ :
password:
  • By the input typevalue read passwordin terms of specific password field to text field (i.e., input is not visible or ????? **)

Radio buttons and check boxes (Radio Buttons, ChackBoxes)

<input type="radio">

<input type="checkbox">

<form>
<input type="radio" name="sex" value="male">Male
<input type="radio" name="sex" value="female">Female<br>
<input type="checkbox" name="vehicle" value="Bike">I have a bike
<input type="checkbox" name="vehicle" value="Car">I have a car
</form> 


Male
Female

I have a bike
I have a car

  • With a namesingle-box attributes for a group (a group can only select a)
  • valuePerhaps the return value of a button, speculating on the bin

select the selection list

<form action="">
<select name="cars">
<option value="null">请选择性别</option>
<option value="1">男</option>
<option value="2">女</option>
<option value="3" selected>不详</option>
</select>
</form>
  • No extra explanation, the code can be
  • Can optionadd a label selectedelements is the default item, if not, the default is the firstoption

Submit button (Submit Button)

<input type="submit">It defines the submit button.

As the name implies, forms the extracted data to somewhere

  • 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.

Guess you like

Origin www.cnblogs.com/jumpywin/p/11926843.html