The difference between name and value in the input tag

Time:2021-10-15

Type browser controls for access (for example, type = “text”, which is a text box; type = “button”, which is a button)
The optional values of type are as follows:
Button button
Checkbox check button component
File upload component
Hidden hidden domain
Image picture area
Password password input text box
Radio button component
Reset reset form button
Submit submit form button
Texttext input box
***********************************************************************
ID is a unique identifier. Duplicate values (similar to the primary key (PK) of a data table) are not allowed. The corresponding HTML tag object can be obtained from its value. (if there are duplicate IDS in the same page code, it will lead to unexpected errors)
JS code: document.getelementbyid (“id_value”)
Gets its object reference based on the specified ID
***********************************************************************
The functions of name and ID are the same. They are also used to identify HTML tags, but the only difference is that name allows duplicate values.
JS code: document.forms [0]. Name or document.getelementsbyname (“name”)
Gets its object reference array according to the specified name
***********************************************************************
Value represents the value of an HTML tag
For example: < input type = “text” name = “SEQ” value = “Hello!” id = “seq007” / >
You will see the content of the text box in the web page as “Hello!”
///////////////////////////////////////////////////////////////////////
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Untitled Document</title>
<script>

</script>
</head>
<body>
<form>
<input type=”text” name=”seq” value=”” id=”seq001″ />
<input type=”text” name=”seq” value=”” id=”seq002″ />
<input type=”text” name=”seq” value=”” id=”seq003″ />
</form>
</body>
</html>
///////////////////////////////////////////////////////////////////////
Document. Getelementbyid (“seq001”) obtains the reference of the object label with id = seq001
document.forms[0].seq
All tag object reference arrays with name = SEQ in the first form in the web page will be returned
document.getElementsByName(“seq”)
All tag object reference arrays with name = SEQ in the web page will be returned

Recommended Today

Swift advanced (XV) extension

The extension in swift is somewhat similar to the category in OC Extension can beenumeration、structural morphology、class、agreementAdd new features□ you can add methods, calculation attributes, subscripts, (convenient) initializers, nested types, protocols, etc What extensions can’t do:□ original functions cannot be overwritten□ you cannot add storage attributes or add attribute observers to existing attributes□ cannot add parent […]