阻止冒泡的方法

标准浏览器 和  ie浏览器 

 w3c的方法是event.stopPropagation()        proPagation  传播  传递

 IE则是使用event.cancelBubble = true       bubble   冒泡  泡泡       cancel 取消

 兼容的写法:

if(event && event.stopPropagation)
        {
             event.stopPropagation();  //  w3c 标准
          }
          else
          {
              event.cancelBubble = true;  // ie 678  ie浏览器
 }

 

posted @ 2018-05-02 22:15  小李HH  阅读(497)  评论(0编辑  收藏  举报