Form structure and form object study notes

1. The form on the webpage (Form) is used to fill in information for the visitors, so as to obtain user information, so that the webpage has interactive functions. The form has two important components: one is the HTML source code that describes the form; the other is the server-side application or client-side script used to process the user input information in the form field, such as Asp, net, JSP, JavaScript, etc.
2. Basic syntax:

<form name="..." action="..." method="...">
<input>
...
<slect>...</select>
...
<textarea>...</textarea>
</form>

1. Single line text input box
Basic syntax:

<input name="text" type="text" maxlength=" " size=" " value=" ">

  • When type == "text", it means that the input information of the input item is a character string.
    Insert picture description here
    Insert picture description here
    2. Submit button and reset button
    Basic syntax: <input name="submit" type="submit" value="提交">
    Submit button: <input name="submit" type="submit" value="重置">
    Insert picture description here
    3. Password input box
    Basic syntax:
<input name="password" type="password" maxlength=" " size=" " value=" ">
  • maxlength indicates the maximum characters that can be entered in the input box.
  • size indicates the number selected in the list.
    Insert picture description here
    Insert picture description here
    4. Checkbox
    Basic syntax:
<input name="checkbox" type="checkbox" value=" ">
  • There are multiple options in the checkbox, so name should be multiple.
  • The value of value should be the same.
    Insert picture description here
    Insert picture description here
    5. Radio button
    Basic syntax:
<input name="checkbox" type="checkbox" value=" " >
  • Only one radio button can be selected, so the value of name should be the same.
  • The value of value should be different.
    Insert picture description here
    Insert picture description here
    6. Image button
    Basic syntax:
<input name="image" type="image" src=" ">
  • image means to create an image control, click on the control image will be submitted.
  • src indicates the path used to set the image.
    Insert picture description here
    Insert picture description here
    7. Multi-line text input box
    Basic syntax:
<textarea name="textarea" cols=" " rows=" " wrap=" "></textarea>
  • <textarea>It is a double label and should be used in the form label.
  • rows represents the number of rows entered in a multi-line text box.
  • cols represents the number of columns entered in the multi-line text box.
  • Wrap means that the default text wraps automatically.
    Insert picture description here
    Insert picture description here
    8. Drop-down list box
    Basic syntax:
<select name=" ">
   <option value=" ">
   ...
 </select>

Insert picture description here
Insert picture description here
9. Multi-select drop-down list box
Basic syntax:

<select name=" " size=“ ” multiple=" ">
    <option value=" ">
    ...
</select>
  • Multipe means that the user is allowed to select multiple items from the list.
    Insert picture description here
    Insert picture description here
    Knowledge summary:
    table structure: <form>...</form>
    input: <input>nine types of single mark and type.
    Multi-line text box: <textarea>...</testarea>
    drop-down list box:<select><option>...<select></option>
Published 7 original articles · praised 45 · visits 257

Guess you like

Origin blog.csdn.net/weixin_46121783/article/details/105486873