而且我的代码如下所示,当邮箱打开时,它在JS代码段中断。如何在mailto正文文本中追加Java脚本代码
<a href="mailto:?subject=This is My Subject&body=Hithis is my text and my page url is"+window.location.href+\" click link to see Greater experienceto" target="_top" class="">
而且我的代码如下所示,当邮箱打开时,它在JS代码段中断。如何在mailto正文文本中追加Java脚本代码
<a href="mailto:?subject=This is My Subject&body=Hithis is my text and my page url is"+window.location.href+\" click link to see Greater experienceto" target="_top" class="">
试试这样说:
<a href="#" onclick="javascript:window.location='mailto:?subject=Interesting information&body=I thought you might find this information interesting: ' + window.location + ' click link to see Greater experienceto'">Click</a>
您的浏览器可能不支持可能。你有没有尝试更新你的浏览器或重新安装?当你实现inbuild函数时,跨浏览器测试总会遇到问题。 为我自己。我会一直建立自己的形式来避免这种情况。其长期的理念,但总是最安全的,并将在未来节省更多的时间。 创建您自己的邮件形式的例子... ..`dds
<form action="mailto:[email protected]" method="post" enctype="text/plain">
Name:<br>
<input type="text" name="name"><br>
E-mail:<br>
<input type="text" name="mail"><br>
Mail:<br>
<input type="text" name="email" style="width:600px; height: 100px"><br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>
`
试试这个。 我希望这会有所帮助.. 如果你想和上面发布的完全一样。你只需要做一些造型。我会推荐的是添加一个div并将其包装在其中。所以例如。
<div id="main-container">
<form>..
..
..
..
</form>
</div>
干杯。 :)
打破如何?您的控制台或记录器有错误吗? 'window.href'是否必须被转义,因为它包含了不属于URL的东西? – jdv
@jdv刚刚更新了问题。我期待的动态网页链接输出为'Hithis是我的文本,我的网页地址是**(h ttp://mydomain.com/mypage)**点击链接查看更多的体验到' –
在任何地方使用调试器浏览器检查'window.location.href'来查看它的设置。顺便说一句,我认为这个问题是重复的:https://stackoverflow.com/q/17863986/1531971 – jdv