What are the form methods in javascript
This article mainly talks about "what are the form methods in javascript". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let the editor take you to learn "what are the form methods in javascript"?
There are two built-in form methods in javascript: 1, reset (), which is used to reset all input elements of the form to their default values, and 2, submit (), which is used to submit form data to the Web server.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
The Form object represents an HTML form.
Every time it appears in an HTML document, a Form object is created.
Form users are usually used to collect user data and contain input elements such as text fields, check boxes, checkboxes, submit buttons, and so on. Forms can also be called option menus, textarea, fieldset, legend, and label elements.
The form is used to send data to the server.
Methods for javascript form objects (form):
The method description reset () resets all input elements of the form to their default values. Submit () submits the form.
The reset () method of Form object
The reset () method resets the elements in the form to their default values.
Syntax: formObject.reset ()
Note: the result of calling this method is similar to that when the user clicks the Reset button, except that the form's event handle onreset will not be called.
Example:
Function formReset () {document.getElementById ("frm1") .reset ();
Enter some text in the input box below, and then press the reset form button to reset the form.
User name:
Secret code:
At this point, I believe you have a deeper understanding of "what are the form methods in javascript?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!