Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use form form tags in HTML5

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of how to use form form tags in HTML5, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value, I believe you will have something to gain after reading this HTML5 article on how to use form form tags. Let's take a look at it.

Syntax:

Explanation: 1. Forms must be placed in between when they appear in pairs, beginning and ending.

2.method transmission mode, get/post is a problem considered by back-end programmers

Where the data entered by the 3.action viewer is transferred, such as a php page, (save.php)

User name:

Password:

Text input box, password input box

When users need to type letters, data, etc., into the form, they need to use a text input box, which can also be converted into a password input box.

Syntax:

Explanation: 1.type:

Input box for text when type is text

Enter the password box when type is password

2.name: name the text box for use by the background aspphp

3.value: sets the default value for the text input box (usually used as a prompt)

Text input box, password input box

Account:

Password:

Results:

Account:

Password:

Text fields: support for multi-line text input

Text input fields are used when users need to enter large chunks of text into the form

Syntax:

Text

Explanation: 1. Text input field to start and end

2.rows: enter the number of lines in the text input field

3.cols: enter the number of columns in the text input field

4. Enter default values between tags

Text field

Personal introduction

Enter the content here.

Results:

Personal introduction

It will be explained in detail later.

Using the check box, the check box lets the user select

When using the form to design the questionnaire, in order to reduce the user's operation, using the selection box is a good way. In HTML, there are checkboxes and check boxes. The main difference between the two is that the user can only choose one item in the checkbox, while the user can select multiple items or even all of them at will in the check box.

Explanation:

1.type:radio: control radio box

Checkbox: control check box

2.value: provides the value of the data to the server

3.name: name the control for use by the daemon ASP,PHP

4.checked: this option is selected by default when setting checked= "checked".

Check boxes, check boxes

Do you like to travel?

Which sports are you interested in?

Results:

Do you like to travel?

Which sports are you interested in?

Note: the same group of radio buttons, the value of name must be the same, so that the same group of radio buttons can play the role of radio.

Drop-down list box

Use the drop-down list box to save space. You can select both single and multiple options.

Select:

Drop-down page table box

Hobbies:

read

Exercise

Music

Travel

Shopping

Results: hobbies: reading, sports, music, travel, shopping (can be pulled down)

Option

Submitted value: is the value submitted to the server

Options: is the displayed valu

Set selected= "selected" and this option is selected by default.

Multiple selection:

Just change the above to the line, then ctrl under widows, and click at the same time, click Command+ under Mac

Use the submit button to submit data

There are two kinds of buttons available in the form, the submit button and the reset button, and the submit button is needed when the user needs to submit information to the server.

Syntax:

Explanation:

1. The button has the function of submitting only when type= "sumit"

2.value: the word displayed on the button

Reset

When the user needs to reset the form information to its initial state, you can use the reset button, just change type to reset.

Explanation:

1. By the same token, the submit button has a reset effect only when type= "reset"

2.value: text displayed on the button

Label tag

The label tag does not present any special effect to the user, its function is to improve the usability of the mouse user, if you click the text inside the label tag, the control will be triggered, that is, when the user clicks to select the label tag, the browser will automatically shift the focus to the form control associated with the tag (automatically select the form control associated with the label tag)

Syntax:

Note: the value of the for attribute in the label must be the same as the value of the id attribute of the related control

Male

Female

Enter your email address

Results:

Male

Female

Enter your email address

The following is my own imitation, which can be checked:

Lable tags in form

What sports are you interested in:

Jogging

Mountaineering

Basketball

Results:

What sports are you interested in:

Jogging

Mountaineering

Basketball

This is the end of the article on "how to use form form tags in HTML5". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to use form form tags in HTML5". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report