就是取消冒泡。
我是菜鸟

解决方案 »

  1.   

    a lot of events are passed upward through the DOM object structure, but you can use event.cancelBubble=true to stop this "bubbling". For example, if you click on the following button, the alert message boxes in both the button's onclick event handler and the document's onclick event handler will be displayed. But if you uncomment the cancelBubble line, you will only see the alert box in the button's event handler get displayed:
    <script language="javascript">
    function document.onclick()
    {
      alert("in the document's event handler!");
    }function clickMe()
    {
      alert("in the button's event handler!");
      //event.cancelBubble = true;
    }
    </script> <input type="button" value="click me" onclick="clickMe()">