1.事件冒泡:
//取消冒泡 if(e.stopPropagation){ e.stopPropagation();//w3c定義的APIbiaozhun}else{ e.cancelBubble=true;//兼容IE 6,7,8瀏覽器}2.獲取某個(gè)元素的CSS屬性值:
//獲取某個(gè)元素的CSS屬性值function getStyle(element,stylename){ if(element.currentStyle){ //IE return element.currentStyle[stylename]; }else{ //其他瀏覽器 var computedStyle=window.getComputedStyle(element,null); return computedStyle[stylename]; }} 以上這篇javascript兼容性(實(shí)例講解)就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持錯(cuò)新站長(zhǎng)站。
新聞熱點(diǎn)
疑難解答
圖片精選