x
 
<!DOCTYPE html>
<html>
<body>
<form target="_blank">
  名字:<input type="text" name="fname" value="Bill"><br>
  姓氏:<input type="text" name="lname" value="Gates"><br>
  <input type="submit" id="mySubmit" formaction="/demo/htmldom/action_page.php" formmethod="get" value="提交">
</form>
<p>单击“更改 formsmethod”按钮可以更改上面表单中提交按钮的 formmethod。</p>
<button onclick="myFunction()">更改 formmethod</button>
<p id="demo"></p>
<script>
function myFunction() {
  document.getElementById("mySubmit").formMethod = "post";
  document.getElementById("demo").innerHTML = "该 formaction 现在是'POST'。";
}
</script>
</body>
</html>