开发者

Stop href event bubbling

I'm creating a td tag from javascript. It has an addEventListener/attachEvent set for clicks. Inside this tag I have an inner w开发者_Go百科ith 'a' tag. I need to run the href without triggering the td click. Until now i have it working in IE:

cell1.innerHTML = "<a href='"+url+"' onclick='event.cancelBubble = true; 
if(event.stopPropagation) { event.stopPropagation(); }'>"


I've got it working in chrome by setting the catch event to bubble (the 'false' statement)

cell.addEventListener("click", function(){          
        ...},false);    
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜