当前位置:K88软件开发文章中心编程语言Html5Html501 → 文章内容

HTML button formmethod 属性

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-26 10:39:55

由 ega520 创建,Carrie 最后一次修改 2016-08-23 HTML <button> formmethod 属性 HTML <button> 标签formmethod 属性定义通过哪种方式发送 form-data,它将覆盖 <form> 标签中的 method 属性,请参考下述示例:实例带有两个提交按钮的表单,第一个提交按钮使用 method="get" 提交表单数据,第二个提交按钮使用 method="post" 提交表单数据: <form action="demo_form.html" method="get">First name: <input type="text" name="fname"><br>Last name: <input type="text" name="lname"><br><button type="submit">提交</button><button type="submit" formmethod="post" formaction="demo_post.html">使用 POST 提交</button></form>尝试一下 ?浏览器支持Internet Explorer 10, Firefox, Opera, Chrome, 和 Safari 支持 formmethod 属性。注意:Internet Explorer 9 及更早IE版本不支持 formmethod 属性。定义和用法formmethod 属性制定发送表单数据使用的 HTTP 方法。formmethod 属性覆盖 form 元素的 method 属性。formmethod 属性需与 type="submit" 配合使用。可以通过以下方式发送 form-data :以 URL 变量 (使用 method="get") 的形式来发送以 HTTP post (使用 method="post") 的形式来发送使用 "get" 方法:表单数据在URL中以 name/value 对出现。get传送的数据量较小,不能大于2KB,这主要是因为受URL长度限制。不要使用 "get" 方法传送敏感信息!(密码或者敏感信息会出现在浏览器的地址栏中)使用 "post" 方法:以 HTTP post 形式发送表单数据。比 "get" 方法更强大更安全。没有大小限制HTML 4.01 与 HTML5之间的差异formmethod 属性是 HTML 5 中的新属性。语法<button type="submit" formmethod="get|post">属性值值 描述 get 向 URL 追加表单数据(form-data):URL?name=value&name=value post 以 HTTP post 事务的形式发送表单数据(form-data) HTML <button> 标签

HTML button formmethod 属性