- 0133技术站
- 联系QQ:88526
- QQ交流群

- 微信公众号

如果输入元素是提交按钮或图像,则此属性指定浏览器用于提交表单的HTTP方法。可能的值是:
post:表单中的数据包含在表单的正文中,并发送到服务器。
get:表单中的数据被附加到表单属性URI中,并带有“?”作为分隔符,并将得到的URI发送到服务器。当窗体只包含ASCII字符时,请使用此方法。
Internet Explorer 10、Firefox、Opera、Chrome 和 Safari 支持 formmethod 属性。
注意:Internet Explorer 9 及之前的版本不支持 <input> 标签的 formmethod 属性。
formmethod 属性是 HTML5 中的新属性。
<input formmethod="get|post">
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <form action="demo-form.php" method="get"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> <input type="submit" value="提交"> <input type="submit" formmethod="post" formaction="demo-post.php" value="使用 POST 提交"> </form> </body> </html>
点击 "运行实例" 按钮查看在线实例
推荐手册