将电子邮件从HTML发送到JavaScript

编程入门 行业动态 更新时间:2024-10-21 14:23:08
本文介绍了将电子邮件从HTML发送到JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好,我得到了一个作业,我无法弄清楚如何根据字段发送电子邮件。 例如我有四个文本字段:title ,姓/名和电子邮件。 然后按一下确认按钮。按下按钮时,它将运行脚本。 我运行了脚本,但只有固定数据,这不是必需的。 提前致谢! 这是我的剧本:

< script > function sendEmail() / *此脚本按确认将自动打开默认电子邮件软件,以便将电子邮件发送到主题Assignment4提供的地址和来自输入字段的正文。 * / { window.open('mailto:test@example?subject = Assignment4& body = SUSHI-MASTER James Tam'); } < / script >

解决方案

1。如上所述创建带有文本框的表单 2.

隐藏复制代码 < script > function sendEmail() / *此脚本按确认将自动打开默认电子邮件软件,以便将电子邮件发送到主题Assignment4提供的地址和来自输入字段的正文。 * / { window.open('mailto:'+ document.getElementById(txtMailToId)。value +'?subject ='+ document.getElementById(txtTitle )。value +'4& body ='+ document.getElementById(txtFirstName)。value ++ document.getElementById(txtLastName)。value); } < / script >

Hello I got an assignment and I can't figure out how to send email based on the fields. So for example I have four text fields: title, first/last name and email. Then a button "confirm". When the button is pressed it will run the script. I got the script running but only with fixed data, which is not quite what is required. Thanks in advance! This is my script:

<script> function sendEmail() /* This script by pressing "Confirm" will automatically open a default email software to send email to the address provided with subject "Assignment4" and body from the input fields. */ { window.open('mailto:test@example?subject=Assignment4&body=SUSHI-MASTER James Tam'); } </script>

解决方案

1. Create a form with textboxes as you have mentioned 2.

Hide Copy Code <script> function sendEmail() /* This script by pressing "Confirm" will automatically open a default email software to send email to the address provided with subject "Assignment4" and body from the input fields. */ { window.open('mailto:'+document.getElementById ( " txtMailToId").value+'?subject='+document.getElementById ( " txtTitle").value+'4&body='+document.getElementById ( " txtFirstName").value+" " + document.getElementById ( " txtLastName").value); } </script>

更多推荐

将电子邮件从HTML发送到JavaScript

本文发布于:2023-10-13 00:00:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1486240.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:发送到   电子邮件   HTML   JavaScript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!