2012-03-31 72 views

回答

2

使用JavaScript的鏈接的點擊事件window.location的

<a href="mailto:[email protected]" onclick="window.location=another.html">email</a> 

更新:

如果有堆積,大量的代碼在onclick事件,創建一個函數,而不是

function handleClick() { 
    _gaq.push(['_trackEvent', 'emails', 'clicked', 'lead']); //first this 
    window.open = 'anotherpage.html'; //or window.location for redirection 
} 

HTML

<a onclick="handleClick()" href="mailto:[email protected]">email.com</a> 
+0

謝謝。我是否需要指定js,或者如果我剪切/粘貼所寫的內容足以使鏈接起作用? – 2012-03-31 21:54:02

+0

也有,事實上已經有另一個onclick事件附加到mailto鏈接 - 我仍然可以使用2?現在的HTML實際上是:email.com 2012-03-31 21:56:08

+0

@DougFirr,看到我的更新 – Starx 2012-03-31 22:02:22