<!DOCTYPE html>
<html>
<body>
<form id="myForm" action="demo_form_method.asp" method="get" target="_blank">
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>Click the "Try it" button to change the value of the method and action attributes in the form above.</p>
<p><b>Note:</b> Click on the "Submit" button before and after you have clicked on the "Try it" button, to see the effect!</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("myForm").method = "post";
document.getElementById("myForm").action = "demo_form_method_post.asp";
document.getElementById("demo").innerHTML = "The value of action and method was changed.";
}
</script>
</body>
</html>