(资料图)
1、你是指事件冒泡么,作为一个编程菜鸟,我平常用stopPropagation来阻止事件冒泡例://这里我没给div加样式。
2、自己随便加个长和宽背景色就行了var inner = document.getElementById("inner");inner.onclick = function(e){alert("里面");if(e && e.stopPropagation()){stopPropagation();}else{window.event.cancelBubble = true;//ie不支持stopPropagation方法,需要用window.event.cancelBubble}}。
本文分享完毕,希望对大家有所帮助。