Home  >  Article  >  Web Front-end  >  The difference between name and value in input tag_HTML/Xhtml_Web page production

The difference between name and value in input tag_HTML/Xhtml_Web page production

WBOY
WBOYOriginal
2016-05-16 16:42:302275browse

type control used for entry and exit in the browser (for example, type="text", this is a text box; type="button", this is a button)
The optional values ​​​​of type are as follows:
button button
checkbox check button component
file file upload component
hidden hidden field
image picture area
password password input text box
radio radio button component
reset reset form Button
submit submit form button
text text input box
********************************** ***************************************
id is a unique identifier and is not allowed There are duplicate values ​​(similar to the primary key of a data table, pk), and the corresponding html tag object can be obtained through its value. (If duplicate ids appear in the same page code, unpredictable errors will occur)
js code: document.getElementById("id_value")
Get 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 repeated values. .
js code: document.forms[0].name or document.getElementsByName("name")
Get its object reference array based on the specified name
************* *************************************************** **********
value represents the value of an html tag
For example:
You will see that the content of the text box on the web page is "hello!"
/////////////////////////////////////////////////// ////////////////////////




Untitled Document











///////////////////////////// ///////////////////////////////////////////
document.getElementById(" seq001") obtains the reference of the object label with id=seq001
document.forms[0].seq
will return an array of all label object references with name=seq in the first form in the web page
document.getElementsByName("seq") <script> <br /><br /></script> will return an array of tag object references with name=seq in the web page
Statement:
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