Home > Web Front-end > JS Tutorial > body text

JavaScript method to obtain web form submission method_javascript skills

WBOY
Release: 2016-05-16 16:06:13
Original
1277 people have browsed it

The example in this article describes the method of using JavaScript to obtain the web form submission method. Share it with everyone for your reference. The details are as follows:

JavaScript obtains whether the submission method of a web form is get or post. Obtaining the submission method can be obtained through the method attribute of the form

<!DOCTYPE html>
<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>
</html>
Copy after login

The running results are as follows:

The method for sending form-data is:get
Copy after login

I hope this article will be helpful to everyone’s JavaScript programming design.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template