Introduction to the functions and usage of value and name attributes in Html

Introduction to the functions and usage of value and name attributes in Html
1. The value used in the button refers to the text to be displayed on the button, such as "OK", "Delete", etc.

2. The value used for the checkbox refers to the value of the checkbox

3. The value used for radio buttons is the same as that for check boxes

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

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


In the background, if you want to get the content of the checkbox, it is value. When you get data on the page that receives form data, you get the value of value.

1. name is the name of the control (multiple controls can have the same name), and value is the value of the control;
2. Not all controls’ values ​​are displayed, such as checkbox, radio, hidden.
3. Define the name and value of the control to get the control and its value on the server;
4. If you don't see the name of submit, it doesn't mean that the browser ignores its name. Before submission, the browser also defines a name, and its name and value can still be obtained on the server;
5. A control can be displayed without defining a name/value. Its name/value is defined only to facilitate reception and distinction on the server. Of course, the value of a button is not only used to store its value, but also for display.
[code]
<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="OK"/>
<SPAN style="WHITE-SPACE: pre">&nbsp;<input type="text" value="Please enter content"/> </SPAN>
</html>

<<:  Summary of Form Design Techniques in Web Design

>>:  Running PostgreSQL in Docker and recommending several connection tools

Recommend

Jmeter connects to the database process diagram

1. Download the MySQL jdbc driver (mysql-connecto...

jQuery uses the canvas tag to draw the verification code

The <canvas> element is designed for client...

Detailed explanation of props and context parameters of SetUp function in Vue3

1. The first parameter props of the setUp functio...

Detailed explanation of how to use JavaScript paging component

The pagination component is a common component in...

Incomplete solution for using input type=text value=str

I encountered a very strange problem today. Look a...

Baota Linux panel command list

Table of contents Install Pagoda Management Pagod...

Detailed explanation of Vue's keyboard events

Table of contents Common key aliases Key without ...

Vue ElementUI Form form validation

Form validation is one of the most commonly used ...

Vue encapsulation component tool $attrs, $listeners usage

Table of contents Preface $attrs example: $listen...

How to add a pop-up bottom action button for element-ui's Select and Cascader

As shown in the figure below, it is a common desi...

How to use Navicat to operate MySQL

Table of contents Preface: 1. Introduction to Nav...

10 very good CSS skills collection and sharing

Here, clever use of CSS techniques allows you to g...

Develop a vue component that encapsulates iframe

Table of contents 1. Component Introduction 2. Co...

Vue complete code to implement single sign-on control

Here is a Vue single sign-on demo for your refere...