html - 用于表单操作的 HTML 和 CSS 按钮
问题描述
我正在为 HTML 和 CSS 中的两个人创建两个联系按钮。我的目标是在单击按钮时,用户将使用 Outlook 平台直接向他们发送邮件。我的 person1 代码如下:
<p><form action="mailto:abc@google.com" method="post" enctype="text/plain"><button class="button1" a href="mailto:abc@google.com">Contact</button></p>
它创建了一个联系按钮,单击该按钮时它会在 Outlook 中显示邮件 ID 为 abc@google.com。这是完美的。
现在 person2 的代码如下:
<p><form action="mailto:xyz@google.com" method="post" enctype="text/plain"><button class="button1" a href="mailto:mailto:xyz@google.com">Contact</button></p>
但是在这里,当单击“联系人”按钮而不是显示“xyz@google.com”id 时,它显示了 person1 的 id,即 abc@google.com。
我无法解决这个问题。
解决方案
只需添加结束标签form
,并更正这一行 - a href="mailto:xyz@google.com"
。
<form action="mailto:abc@google.com" method="post" enctype="text/plain">
<button class="button1" a href="mailto:abc@google.com">Contact</button>
</form>
<form action="mailto:xyz@google.com" method="post" enctype="text/plain">
<button class="button1" a href="mailto:xyz@google.com">Contact</button>
</form>
推荐阅读
- node.js - Discord bot 如何创建私人文本频道
- python - 如何在python中将两个列表转换为没有['xxx']标签的数据框?
- php - 在for循环中重复数组
- javascript - 如果没有用户交互,Chrome popstate 不会在返回按钮上触发
- javascript - 仅当悬停在另一个元素上时如何以闪亮的方式显示浮动元素
- python - RandomForest 是否需要标准化?
- node.js - node.js 中的“npm start”不起作用
- concurrency - 在 OCaml 中使用 Lwt 时如何进行循环中断
- python-3.x - 熊猫如果不工作。尝试了几个选项,但仍然得到不同的错误
- javascript - 为什么 SSR 比 SPA 快,反之亦然?