【问题标题】:Changing the recipient of the mailto to what is entered in the text field将 mailto 的收件人更改为在文本字段中输入的内容
【发布时间】:2015-07-21 04:04:53
【问题描述】:

我想知道是否可以制作一个表单,可以将设置了 mailto 操作的电子邮件更改为在文本字段中输入的内容。

例如:

<form enctype="text/plain" method="get" action="mailto:getElementByName='friend1'" action="cc:manager@crill.com">
Friend 1 <input type="text" name="friend1"><br>
Friend 2 <input type="text" name="friend2"><br>
Friend 3 <input type="text" name="friend3"><br>

<input type="submit" value="Send">
</form> 

因此,如果在名为“Friend 1”的第一个字段中输入:“example1@mail.com”,那么当我按下提交时,我希望它获取放置在第一个字段中的信息并将其设为 mailto .

我为我的英语道歉,希望读过这篇文章的人能理解。 提前谢谢你。

【问题讨论】:

标签: javascript html forms mailto


【解决方案1】:

你可以使用:

<form method="post" action="javascript:;" onSubmit="this.action='mailto:'+document.getElementById('friend1').value;" enctype...>

也可以在这里查看:Is it possible to dynamically set the recipient of MAILTO: with only HTML and JavaScript?

【讨论】:

    猜你喜欢
    • 2023-03-11
    • 1970-01-01
    • 1970-01-01
    • 2010-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-05
    相关资源
    最近更新 更多