JavaScript method for obtaining the webpage form submission method, javascript form
This example describes how to use JavaScript to obtain the webpage form submission method. Share it with you for your reference. The details are as follows:
The JavaScript method for obtaining the webpage form is get or post. The method for obtaining the form can be obtained through the method attribute of the form.
<! DOCTYPE html> <body> <form id = "frm1" action = "form_action.asp" method = "get"> First name: <input type = "text" name = "fname" value = "Donald"> <br> Last name: <input type = "text" name = "lname" value = "Duck"> <br> <input type = "submit" value = "Submit"> </form> <p> The method for sending form-data is: <script> document. write (document. getElementById ("frm1 "). method); </script> </p> </body>
The running result is as follows:
The method for sending form-data is: get
I hope this article will help you design javascript programs.