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兼容性(实例讲解)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。
如对本文有疑问, 点击进行留言回复!!
轻松解决 org.apache.taglibs.standard.tlv.JstlCoreTLV 困惑
vert实践五——Json?Protocol Buffer?FlatBuffers?
[基于tensorflow的人脸检测] 基于神经网络的人脸检测8——验证训练好的神经网络
selenium + ajax抓取英雄联盟全部英雄的详细信息及多线程保存全部皮肤图片到本地
网友评论