HTML Notes (v) forms <form> and their related elements

Source: Internet
Author: User

Form Labels <form>

    • A form is a region that contains form elements.
    • Form elements are elements that allow users to enter information into a form.

  

Input tags <input>

The input type of the input label is determined by its type attribute. The common input types are as follows:

    • Field Text field
<type= "text"  name= "InputName"/>
    • Radio buttons radio button

  Note : You can only select one of these.

<form>    <inputtype= "Radio"name= "Sex"value= "Male" />male<BR/>    <inputtype= "Radio"name= "Sex"value= "female" />female</form>
    • check box checkbox

Used when the user wants to select one or more options from several options.

<form>    <inputtype= "checkbox"name= "Apple" />Apple<BR/>    <inputtype= "checkbox"name= "Banana" />Banana<BR/>    <inputtype= "checkbox"name= "Orange" />Orange</form>
    • Buttons button
< form >    <  type= "button"  value= "click me"></  Form>
    • Password Password and submit button submit
<formAction= "target.html"Method= "Get">User:<inputtype= "text"name= "User">    <BR/>Password:<inputtype= "Password"name= "Password">    <BR/>    <inputtype= "Submit"value= "Submit" /></form>

field labels <fieldset> and domain title tags <legend>

Field labels <fieldset> can package related elements within a form and generate a field for a set of related forms. Browsers can display groups of elements in a special way, such as special boundaries, 3D effects, or even create a sub-form to handle these elements.

Field labels <fieldset> no required properties. The <legend> tag defines the title for the field label.

<form>  <fieldset>    <legend>Health information</legend>Height:<inputtype= "text" />    <BR/>Weight:<inputtype= "text" />  </fieldset></form>

 

  <label> tags

The <label> tag defines a tag for the INPUT element. It will not render any special effects, but when you place the mouse over the label element, clicking on the text will trigger the control.

The For property of the <label> tag should be the same as the id attribute of the related element.

<form>    <label for= "Male">Man</label>    <inputtype= "Radio"name= "Sex"ID= "Male" />    <BR/>    <label for= "female">Woman</label>    <inputtype= "Radio"name= "Sex"ID= "female" /></form>

  

Drop-down list <select>

<Select>  <Optgrouplabel= "Swedish Cars">    <optionvalue= "Volvo">Volvo</option>    <optionvalue= "Saab">Saab</option>  </Optgroup>  <Optgrouplabel= "German Cars">    <optionvalue= "Mercedes">Mercedes</option>    <optionvalue= "Audi" selected= "true">Audi</option>  </Optgroup></Select>

HTML Notes (v) forms <form> and their related elements

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.