x
 
<!DOCTYPE html>
<html>
<body>
<form action="/demo/action_page.php" method="get">
  First name: <input type="text" name="fname" value="Bill"><br>
  Last name: <input type="text" name="lname" value="Gates"><br><br>
  <button id="myBtn" type="submit" formmethod="post">提交</button>
</form>
<p>点击“返回方法”按钮可返回上面提交按钮的 formmethod 属性的值。</p>
<button onclick="myFunction()">返回方法</button>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.getElementById("myBtn").formMethod;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>