What do the name and value of html mean?

青灯夜游
Release: 2022-01-21 12:17:28
Original
10216 people have browsed it

In HTML, name means "name" and is used to define the name of the control. Multiple controls can have the same name; while value means "value" and is used to define the content value of the control. .

What do the name and value of html mean?

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

The role and use of the value and name attributes in Html and their use

name is the name of the control (multiple controls can have the same name), value is the name of the control Value, the following introduces the meaning and examples of value in buttons, check boxes, radio boxes, drop-down menus, and hidden fields. Friends who have this need can refer to the following

1, button The value used refers to the text to be displayed on the button, such as "OK", "Delete", etc.

2. The value used in the check box refers to the value of the check box

3 , The value used for the radio button is the same as the check box

4. The value used for the drop-down menu is the value of each sub-item in the list

5. The value used for the hidden field is the value displayed in the box The content

In the background, if you want to get the content of the check box, it is the value.

When you get the data in the page that receives the form data, what you get is the value of the value

1. Name is the name of the control (multiple controls can have the same name), value is the value of the control;

2. Not all values ​​of controls will be displayed, such as checkbox, radio, hidden;

3. Define the name and value of the control to obtain the control and its value on the server;

4. If you don’t see the name of submit, it does not mean that the browser ignores it. Its name is also defined by the browser before submission. Its name and value can also be obtained on the server;

5. The control can be displayed without defining name/value, just for convenience. Its name/value is defined after the server receives and distinguishes it. Of course, the button's value is not only used to store its value, but also used for display.

<html>
<select>
<option value="1">Flowers</option>
<option value="2" selected="selected">Gardens</option>
<option value="3">Trees</option>
</select>
<form>
<input type="checkbox" name="newsletter" checked="checked" value="Daily" />vjn
<input type="checkbox" name="newsletter" value="Weekly" />bvc
<input type="checkbox" name="newsletter" checked="checked" value="Monthly" />cvb
</form>
<input type="button" value="确定"/>
<SPAN style="WHITE-SPACE: pre"> <input type="text" value="请输入内容"/> </SPAN>
</html>
Copy after login

What do the name and value of html mean?

Related recommendations: "html video tutorial"

The above is the detailed content of What do the name and value of html mean?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template