Preface
Why write it in chapters? Because it covers a lot of knowledge points, I may try my best to introduce it in detail to take care of people with poor foundation, so as to review the past and learn the new.
At the beginning, I really planned to finish it in one article. Halfway through, I realized that it was already quite a long article. Many people, such as me, were already scared when they saw so much content. And not everyone needs to understand all the content, so I decided to separate it. , let readers know as needed.
As for why there is a chapter zero? Because it is too basic, most people can ignore it. It is only for a small number of novices and people with poor memory. If you think you can, just skip it.
Let’s start by saying that business uploading has always been a scary thing for me, and I have had relatively little exposure to it, because there were no standards before. In order to achieve an upload, I had to write all kinds of disgusting compatibility codes, and plug-ins are often prone to bugs and I have no ability to modify them. To this day, real warriors always have to face the bloody reality, so I specially opened a literacy post to study and summarize some knowledge about uploading. Here I will take you to browse some APIs I need to use.
Zero, basics (knowledge points mainly come from w3school) (those who are already familiar with it can just skip this chapter)
<form action= method= ></form>
Tags are used to create HTML forms for user input. Forms can contain input elements, such as text fields, check boxes, radio buttons, submit buttons, etc. Forms can also contain menu, textarea, fieldset, legend, and label elements. Forms are used to transfer data to the server.
Field | describe |
---|---|
name | Specifies the name of the form |
action | Specifies where to send form data when the form is submitted |
enctype | (on/off) specifies how to encode form data before sending it |
method | (get/post) Specifies the HTTP method used to send form-data |
novalidate | If this attribute is used, no validation is performed when the form is submitted. (Html5 attribute) |
onsubmit | The onsubmit attribute of the Form object specifies an event handler function. This event handler function is called when the user clicks the Submit button in the form to submit a form. Note that this handler function is not called when the method Form.submit() is called. If the onsubmit handler returns fasle, the form elements will not be submitted. If the function returns another value or nothing, the form is submitted |
For details, please click on the About form
label
<label for=male>Male</label><input type=radio name=sex id=male /><label for=girl>Girl</label><input type=radio name=sex id=girl />
The label element does not present any special effects to the user. However, it improves usability for mouse users. This control is triggered if you click on the text within the label element. That is to say, when the user selects the label, the browser will automatically turn the focus to the form control related to the label. The tag's for attribute should be the same as the related element's id attribute.
Field | describe |
---|---|
for | Specifies which form element the label is bound to |
form | Specifies one or more forms to which the label field belongs |
For details, please click on the About label
input
<input type=text name=fname/><input type=password name=password><input type=checkbox name=Bike><input type=checkbox name=Car><input type=radio checked=checked name=Sex value= male/><input type=radio name=Sex value=female/><select name=cars> <option value=volvo>Volvo</option> <option value=saab>Saab</option> <option value=fiat>Fiat</option> <option value=audi>Audi</option></select><textarea rows=10 cols=30>
Tags are used to collect user information. Input fields have many forms depending on the value of the type attribute. Input fields can be text fields, checkboxes, coded text controls, radio buttons, buttons, etc.
For details, please click on input
<input type=submit value=Submit>
The Submit object represents a submit button in an HTML form. Before the form is submitted, the onclick event handler is triggered, and a handler can cancel the form submission by returning fasle.
submit: Submit form data to the Web server. This method submits the form in the same way as if the user clicked the Submit button, but the form's onsubmit event handler will not be called.
For details, please click on submit
<button type=button>Click Me!</button>
Inside the button element, you can place content, such as text or images. This is the difference between this element and buttons created using the input element.
Compared with <input type=button>, the <button> control provides more powerful functions and richer content. Everything between the tags is the content of the button, including any acceptable body content, such as text or multimedia content. For example, we can include an image and associated text in a button and use them to create an attractive markup image in the button.
The only prohibited element is the image map, as its mouse- and keyboard-sensitive actions interfere with the behavior of the form buttons.
Always specify the type attribute for buttons. The default type in Internet Explorer is button, while the default in other browsers (including the W3C specification) is submit.
(Important: If you use the button element in an HTML form, different browsers will submit different values. Internet Explorer will submit the text between <button> and <button/>, while other browsers will submit the contents of the value attribute . Please use input elements in HTML forms to create buttons.)
Field | describe |
---|---|
name | Specifies the name of the button |
disabled | Specifies that the button should be disabled |
For details, please click on the About button