简体   繁体   English

将mailto的收件人更改为在文本字段中输入的内容

[英]Changing the recipient of the mailto to what is entered in the text field

I wanted to know if it possible to make a form where one could change the email to which the mailto action is set, to what is entered in the text field. 我想知道是否有可能制作一种表格,使人们可以将设置了mailto操作的电子邮件更改为在文本字段中输入的内容。

for example: 例如:

<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> 

So if in the first field named "Friend 1" I would enter: "example1@mail.com", then when I press submit I wanted it to take the info that was placed into the first field and make it the mailto. 因此,如果在名为“ Friend 1”的第一个字段中输入:“ example1@mail.com”,那么当我按Submit时,我希望它获取放入第一个字段中的信息并将其作为mailto。

I apologise for my english, hope whom ever reads this understands it. 我为我的英语道歉,希望读过这篇文章的人能理解。 Thank you in advance. 先感谢您。

You could do it by using: 您可以使用以下方法做到这一点:

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

Check here too: Is it possible to dynamically set the recipient of MAILTO: with only HTML and JavaScript? 也请在此处检查: 是否可以仅使用HTML和JavaScript动态设置MAILTO:的收件人?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM