Original
https://www.jianshu.com/p/4466b8294007
Outline
1, form submission method get and post difference
2, JS cannot assign the value of the file type of input
3. JS gets the value in input why is the string always
4. Alternative settings for read-only form controls ==readonly
Recommended
1, form submission method get and post difference
In essence, a get commit is the form information that the page submits after the URL, and nothing is followed after post.
This makes a difference:
1, get the confidentiality of the post will be much lower than 2, get submitted URL will keep up with a very long commit information, but the URL of the domain name resolution is also a certain length limit, so not all can be used to get the way to submit 3, in some get way to submit the content of the confidentiality requirements are not so high Time, you can use get, and the Get method behind the content can be used for resource positioning, and post cannot do, because the post comes out of the URL there is no other content, and get the way to submit the back can still keep up with some content, With these content browsers you can navigate to a more granular place under that URL, which is called resource positioning. 2, JS cannot assign the value of the file type of input
For security restrictions, the value of file is read-only and can only be selected by the user or entered manually, and is not allowed by program code. In other words, the <input type= "file" > Type input box does not support code settings for value values.
3. JS gets the value in input why is the string always
Using JS to get the value in input is the data type of the string, but it is not surprising that the value in input is only a string, but the value obtained by JS is the format of the string output.
Input,textarea is a string by default. No content is an empty string. It can be understood as the norm.
The reason for this problem is due to the method design of the JavaScript-implemented DOM interface. (If you are interested in in-depth readers can check the standard)
4. Alternative settings for read-only form controls ==readonly
<input type= "text" value= "focus but Blur" onfocus= "blur ()" >
Recommended
Here are two articles that are also my blog, a detailed article about the form and the knowledge points of the form elements of the HTML form elements and form elements of the details, as well as I use the form of an instance of the application of HTML forms use instances, also hope to be helpful to the reader.
Problems encountered in HTML forms