我想将其添加到链接中。
onclick="javascript:window.location='mailto:?subject=Interesting information&body=I thought you might find this information interesting: ' + window.location;"
所以它给出了
<a id="email" href="#" onclick="javascript:window.location='mailto:?subject=Interesting information&body=I thought you might find this information interesting: ' + window.location;">Email</a>
我尝试过类似的事情:
$("#email").find("a").onclick = function () {
javascript:window.location= 'mailto:?subject=Interesting information&body=I thought you might find this information interesting: ' + window.location;
}
但它不起作用。
答案 0 :(得分:1)
onclick
事件已弃用。试试这个:
$("a#email").click(function () {
window.location.href = 'mailto:?subject=Interesting information&body=I thought you might find this information interesting: ' + window.location.href;
}