Explorer中无法工作

Explorer中无法工作

本文介绍了在表单操作中使用mailto的HTML表单邮件在Internet Explorer中无法工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的客户有一个register.html页面,其格式非常简单,允许用户将其详细信息输入客户网站。

A customer of ours has a register.html page with a very simple form that allows users to enter their details for registration to the clients website.

表单操作被设置为mailto:clientsemail.client.com?subject = subject。页面的类型设置为文本/纯文本,方法是发布。

The form action is set to "mailto:clientsemail.client.com?subject=subject". The enctype of the page is set to text/plain and the method is post.

应该怎么做的是,用户电子邮件客户端打开一个新的电子邮件,主题将表单和表单文本框张贴到表单的正文中。然后,网站访问者可以简单地发送电子邮件。

What should happen is that the users email client opens with a new email, with the subject set and the forms text boxes posted into the body of the form. Then the website visitor can simply send the email.

我知道的不是很优雅,但它是如何设置的。

It's not very elegant I know, but its how they have it set up.

现在,这一切都按预期工作,并使用网络访问者电子邮件客户端发送一个相当笨拙的电子邮件到正确的地址,但只能在Firefox,chrome和opera中。 Safari完全错误,互联网浏览器打开电子邮件客户端并填写地址和主题字段,但表单输入不会复制到正文。

Now, this all works as expected and sends a rather clunky looking email to the correct address using the web visitors email client, but only in Firefox, chrome and opera. Safari bugs out completely, and internet explorer opens the email client and populates the address and subject fields, but the form inputs are not copied to the body.

有没有人知道为什么这是?它驱动我坚果。一整天都在看着,我在这个主题上发现的每篇文章都说明了它的设置是正确的,应该工作。 Theres没有提到它在IE中不起作用。

Does anyone know why this is? its driving me nuts. Been looking at it all day and every post I find on the subject states its setup correctly and should work. Theres no mention of it not working in IE.

推荐答案

mailto 标签只能接受以下参数:

The mailto tag should only accept the following parameters:


  1. [email protected]碳复制电子邮件地址

  2. [email protected]盲文复印电子邮件地址

  3. 主题=电子邮件主题文本主题

  4. 正文= body text

  1. [email protected] carbon copy e-mail address
  2. [email protected] blind carbon copy e-mail address
  3. subject=subject text subject of e-mail
  4. body=body text

所有其他输入参数都被丢弃(即FirstName,LastName等)

All other input parameters are discarded (i.e. FirstName, LastName, etc...)

作为解决方法,您可以在表单中添加隐藏的身体输入,并使用提交事件中所需的任何文本填充。

As a workaround, you can add a hidden body input to the form, and populate it with whatever text you want in the submit event.

示例:

<html>
<head>
<title></title>
</head>
<body>
    <script type="text/javascript">
        function beforeSubmit() {
            var firstName = document.getElementById("FirstName");
            var lastName = document.getElementById("LastName");
            var body = document.getElementById("body");
            body.value = firstName.value + lastName.value;
    }
</script>

    <form action="mailto:[email protected]" enctype="text/plain" onsubmit="beforeSubmit()">
        <input name="Subject" id="Subject" type="text" value="" /><br/>
        <input name="FirstName" id="FirstName" type="text" value="" /><br />
        <input name="LastName" id="LastName" type="text" value="" /><br />
        <input name="body" id="body" type="hidden" value="" /><br />
        <input name="Submit" id="submit" type="submit" value="Submit" /><br/>
        <input name="Reset" id="Reset" type="reset" value="Reset" /><br />
    </form>
</body>

这篇关于在表单操作中使用mailto的HTML表单邮件在Internet Explorer中无法工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 22:50