HTML tags used four

Forms

  1. Form of composition
    • Form usually consists of a complete form fields, form controls (also known as form elements) and each 3-part message
  2. Form fields
    • Form field is a region containing form elements
    • In HTML, <form> tag defined with de-form field to enable collection and transmission of user information
<form action="url地址" method="提交方式" name=”表单域名称“>
    各种表单元素空间
</form>
Attributes Property Value effect
action url address url address of the server program to accept and process for specifying form data
method get\post Submission of the form data set for evaluating to get \ post
name name To specify the name of the form, to distinguish the plurality of form fields of the same page
  1. Form elements

    • May be defined in a variety of form elements form field, the form element is to allow a user to enter or select the content control in the form

    • input input form elements

      • When the input of the input means, into a form element <input> tag is used to collect user information
      • In the <input> tag includes a type attribute, depending on the value of the type attribute has a wide variety of forms input field (which may be text fields, check boxes, text control after the mask, radio buttons, buttons, etc.)
      <input type="属性值" />
      • <Input /> tag is a single tag

      • Different type attribute set property values ​​used to specify different types of controls

        Property Value description
        button Custom button (js startup scripts for most cases)
        checkbox Check box
        file Input fields and the "Browse" button for uploading files
        hidden Definition of hidden input field
        image Define the image of the form submit button
        password Define a password field, which the characters are masked
        radio Custom radio button
        reset Define the reset button, reset button will erase all data in the form of
        submit Defined submit button, the button will submit the form data to the server
        text Single line input field is defined, the user can enter text, default width is 20 bytes
        name Defines the name of the input element
        value Value defines the input of
        checked input element is loaded for the first time should be selected
        maxlength The maximum length of the character input field
        placeholder input text box, inside there are initial text prompts, when clicked, the text disappears
      • name, value is the attribute value of each form element has mainly used for back office staff
      • Name name form elements, requiring radio buttons and checkboxes have the same name value
      • checked property mainly for radio buttons and check boxes, the main role of an open page, select a default may be the main form element

    • <Label> tag is defined as an input element graphing

      • <Label> tag is used to bind a form element, click <lable> tag in the text, the browser will automatically focus (cursor) to select or the corresponding form elements for increasing the user experience
      <label for="sex">男</label>
      <input type="radio" name="sex" id="sex">

      [Note] <label> tag for attribute should be the same as the id attribute related elements

    • select the drop-down form elements

      <select>
          <option>选项1</option>
          <option>选项2</option>
          <option>选项3</option>
      </select>
      • <Select> comprises at least one pair of <option>
      • When the <option> is defined in select = "select", the current item is the default option
    • textarea text field elements

      <textarea rows="3" cols="20">
          文本内容
      </textarea>

Guess you like

Origin www.cnblogs.com/SSPOFA/p/11755833.html