我似乎无法阻止IE8执行onclick函数。尝试了许多代码变化,希望得到帮助。目前情况是,当我点击链接时,弹出警告框,这不应该发生。
<p><a href="#" onclick="openMoreProductVideos('Video title','videocode','false');return false;"><span class="txt">View all videos</span></a></p>
function openMoreProductVideos(title,productCode,fastprevoew)
{
alert ("openMoreProductVideos - should not see this!");
}
$('a[onclick^=openMoreProductVideos]').click(function (event) {
if (event.stopPropagation){
event.stopPropagation();
}
else if(window.event){
window.event.cancelBubble=true;
}
return false;
});
alert(event.stopPropagation);
显示什么?为什么你的代码需要两个事件处理程序? - Mark Schultheiss