使用Javascript停止元素事件的传播。非常简单,看代码:

[code lang=”js” highlight=”8″]
function stopPropagation(e) {
if (e && e.stopPropagation) e.stopPropagation(); //W3C;
else window.event.cancelBubble = true; //only ie;
}

<div onclick=”alert(‘div000000000000’);”>
DIV 000000000000000000
<a onclick=”alert(‘div1111111’); stopPropagation(event);” href=”javascript:void(0);”>DIV 111111111111</a
</div>
[/code]

我有话要说