11.18. HTML forms and input

发布时间 : 2025-10-25 13:33:16 UTC      

Page Views: 10 views

HTML forms are used to collect different types of user input.

The HTML form represents an area in the document that contains interactive controls that send the information collected by the user to the Web server.

11.18.1. HTML form

A form is an area that contains form elements.

Form elements allow users to enter content in the form, such as text fields (textarea), drop-down lists, radio-buttons boxes, checkboxes, and so on.

Forms use form tags

to set up:

Example

<form> . *input element* . form>      

11.18.2. HTML form-input element

In most cases, the form tag used is the input tag (< input >).

The input type is defined by the type type. Most of the frequently used input types are as follows:

11.18.3. Text field

The text field is set by the < input type= “text” > tag, which is used when users type letters, numbers, and so on into the form.

<form> First name: <input type="text" name="firstname"><br> Last name: <input type="text" name="lastname"> form>    

The browser displays as follows:

First name: Last name:

Note: the form itself is not visible. Also, in most browsers, the default width of the text field is 20 characters.

11.18.4. Password field

The password field is defined by the label < input type= “password” >:

<form> Password: <input type="password" name="pwd"> form>    

The browser displays as follows:

Password:

Note: password field characters are not displayed in clear text, but are replaced by asterisks or dots.

11.18.5. Radio button

The < input type= “radio” > tag defines the form radio check box option

<form> <input type="radio" name="sex" value="male">Male<br> <input type="radio" name="sex" value="female">Female form>    

The browser displays as follows:

Male

Female

11.18.6. Check box

< input type= “checkbox” > defines a check box. The user needs to select one or more options from several given selections.

<form> <input type="checkbox" name="vehicle" value="Bike">I have a bike<br> <input type="checkbox" name="vehicle" value="Car">I have a car form>    

The browser displays as follows:

I have a bike

I have a car

11.18.7. Submit button

< input type= “submit” > defines the submit button.

When the user clicks the confirm button, the contents of the form are transferred to another file. The action attribute of the form defines the file name of the destination file. This file, defined by the action attribute, usually processes the input data received. :

<form name="input" action="html_form_action.php" method="get"> Username: <input type="text" name="user"> <input type="submit" value="Submit"> form>    

The browser displays as follows:

Username: if you type a few letters in the text box above, and then click the confirm button, the input data will be transferred to the “html_form_action.php” page. The page displays the results of the input.

11.18.8. HTML form label

New: new HTML5 tag

Label

Description

< form >

Define a form for user input

< input >

Define input field

< textarea >

Define a text field (a multiline input control)

< label >

Defines the tag of the < input > element, which is usually the input title

< fieldset >

Defines a set of related form elements and contains them using a bounding box

< legend >

Defines the title of the < fieldset > element

< select >

Defines a list of drop-down options

< optgroup >

Define option groups

< option >

Define options in the drop-down list

< button >

Define a click button

< datalist > New

Specify a predefined list of input control options

< keygen > New

Defines the key pair generator field for the form

< output > New

Define a calculation result

《地理信息系统原理、技术与方法》  97

最近几年来,地理信息系统无论是在理论上还是应用上都处在一个飞速发展的阶段。 GIS被应用于多个领域的建模和决策支持,如城市管理、区划、环境整治等等,地理信息成为信息时代重要的组成部分之一; “数字地球”概念的提出,更进一步推动了作为其技术支撑的GIS的发展。 与此同时,一些学者致力于相关的理论研究,如空间感知、空间数据误差、空间关系的形式化等等。 这恰好说明了地理信息系统作为应用技术和学科的两个方面,并且这两个方面构成了相互促进的发展过程。