1.事件冒泡:
//取消冒泡 if(e.stopPropagation){  e.stopPropagation();//w3c定義的APIbiaozhun}else{  e.cancelBubble=true;//兼容IE 6,7,8瀏覽器}2.獲取某個元素的CSS屬性值:
//獲取某個元素的CSS屬性值function getStyle(element,stylename){ if(element.currentStyle){  //IE  return element.currentStyle[stylename]; }else{  //其他瀏覽器   var computedStyle=window.getComputedStyle(element,null);  return computedStyle[stylename]; }} 以上這篇javascript兼容性(實例講解)就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持武林網。
新聞熱點
疑難解答