0
<a href="http://www.google.com" target="_blank" onClick="javascript:_gaq.push(['_trackEvent', 'Conversion', 'Website', 'abc', 1]);goog_report_conversion_website();">the link</a>

<script type="text/javascript">
    goog_report_conversion_website = function() {
    $('#converstion_tracker_iframe').attr('src', '/conversion_tracker/website/');
    }
</script>

上述链接的预期行为应该是在新窗口中打开链接并执行 2 个 js 函数。但是,goog_report_conversion_website() 函数会导致父页面在打开新窗口时重新加载。

我怀疑这是因为我正在更改父页面的 DOM,有人可以确认一下吗?还有如何在单击链接时停止父页面重新加载?

编辑:看起来更改 iframe 的 src 会导致页面重新加载

4

1 回答 1

0

你试过return false这样添加吗?

<a href="http://www.google.com" target="_blank" onClick="javascript:_gaq.push(['_trackEvent', 'Conversion', 'Website', 'abc', 1]);goog_report_conversion_website(); return false;">the link</a>
于 2012-05-28T23:24:19.130 回答