2022-06-13 594
HTML <button> formmethod 属性
实例
带有两个提交按钮的表单,第一个提交按钮使用 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 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) |
原文链接:https://77isp.com/post/1205.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态