【发布时间】:2016-06-24 00:18:41
【问题描述】:
我正在尝试创建一个简单的链接来打开邮箱以允许用户在小部件中发送反馈。我的代码如下所示:
content: '<p>We welcome questions and comments! Send feedback to Name (<a style="color:white" class="email" title="Send feedback" href="javascript:window.location="mailto:name@domain.com" + window.location;" >name@domain.com</a>).</p>'
我也试过了:
content: '<p>We welcome questions and comments! Send feedback to Sean Barbeau (<a style="color:white" class="email" title="Send feedback" href="mailto:barbeau@cutr.usf.edu" >barbeau@cutr.usf.edu</a>).</p>'
我从这里得到了这个语法: How to write in 'mailto' body link to current page
我在这里阅读了如何处理嵌套: Nesting quotes in JavaScript/HTML
我的问题是,在 chrome 中,这段代码会打开一个新的浏览器页面。我无法理解为什么它会这样,因为我对 javascript 的了解有点有限。
我想了解我做错了什么以及如何解决它。
【问题讨论】:
-
你在最后漏掉了一个单引号。
-
单引号不是问题。我只是忘记了它,因为“内容”中还有其他不相关的东西。我认为它不值得一票否决。
-
嗯,只要提供一个小提琴的意愿来玩arround
标签: javascript html email