阻止冒泡的方法

标准浏览器 和  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浏览器
 }

猜你喜欢

转载自www.cnblogs.com/lhh520/p/8982831.html