Generally, the tag is used in forms to collect user input information. The input type is determined by type. The most commonly used form tag is the input tag (). Input types are defined by the type attribute (type). Common input types include text fields, radio buttons, check boxes, drop-down menus, etc.
Forms in HTML can be used to collect various types of input information from users. A form is actually an area containing form elements. The input information of various elements in this area will eventually be submitted to the program script through the form. For example, common ones include user login, registration, publishing articles, etc., which are all submitted to dynamic programs for processing through forms. This section mainly talks about forms and form elements. How to submit form information to dynamic programs will be discussed in future programming language lessons.
The area of the form uses the
##XML/HTML Code Copy content to clipboard
form>
input type=”text” name=”firstname” / >
input type=”text” name=”lastname” />
form> The browser displays as follows:
Radio button
Radio button in most cases Appears in the options for users to enter information when registering. This type of multi-user only allows users to select one result. The radio button is defined by setting the value of the type attribute to radio in the tag.
<form> <input type=”radio” name=”sex” value=”male” /> 男生 <input type=”radio” name=”sex” value=”female” /> 女生 </form>
Check box
Checkboxes allow users to select one or more options. A common one is to provide users with functions such as remembering their login account when they log in. You can also collect multiple opinions from users on the user survey page. The check box is defined by setting the value of the type attribute to checkbox in the tag
<form> <input type=”checkbox” name=”val1″ /> 前端开拓者不错 <input type=”checkbox” name=”val2″ /> 前端开拓者一般 </form>
Drop-down menu
The drop-down menu is similar to the radio selection in information selection, but the drop-down menu can accommodate more information. And the dropdown menu can execute additional scripts after selecting the menu value. The drop-down menu starts with
<form> <select name=”cars”> <option value=”volvo”>Volvo</option> <option value=”saab”>Saab</option> <option value=”fiat”>Fiat</option> <option value=”audi”>Audi</option> </select> </form>
Submit button
The submit button is every A necessary part of the form. After the user has entered the corresponding information, he needs to click the submit button to trigger the action and submit the form values to the next page. When the action attribute in the