<!DOCTYPE html>
<html>
<body>
<form action="/demo/action_page_binary.php" method="post" enctype="application/x-www-form-urlencoded">
名字:<input type="text" name="fname" value="Bill"><br><br>
<input type="submit" id="mySubmit" formenctype="text/plain" value="提交">
</form>
<p>请点击“试一试”按钮,显示上面提交按钮的 formenctype 属性的值。</p>
<p>请注意,formenctype 属性覆盖了 HTML 表单的 enctype 属性 (application/x-www-form-urlencoded)。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("mySubmit").formEnctype;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>