我有以下JavaScript代码:
$('#ge-display').click(function (event) {
window.open('/googleearth/ge-display.php','','scrollbars=yes,menubar=no,height=650,width=1000,resizable=yes,toolbar=yes,location=no,status=no');
event.stopPropagation();
return false;
});
id为“ge-display”的元素是一个标准链接:
<a href="/googleearth/ge-display.php" id="ge-display" target="_blank">Load Google Earth Plugin (in a new window)</a>
问题是:当我从点击事件处理程序中删除'return false;'行时,JavaScript弹出窗口会打开,然后另一个浏览器窗口会打开 - 我认为stopPropagation()会阻止链接自己的点击处理程序?
我还尝试过stopImmediatePropagation() - 但我仍然需要返回false来停止链接的默认行为。