javascript中getComputedStyle和currentStyle的兼容写法

来源:互联网 发布:上海java培训哪个好 编辑:程序博客网 时间:2024/05/16 13:02

getComputedStyle() 兼容主流浏览器,不支持IE9以下版本
currentStyle      兼容IE任意版本,但~~ 只兼容IE


兼容写法  window.getComputedStyle=window.getComputedStyle||function(obj){ return obj.currentStyle;};

直接使用 getComputedStyle()  方法  getComputedStyle()  没有getComputedStyle的时候说明是IE低版本,调用方法返回currentStyle的值达到兼容IE低版本的目的
阅读全文
0 0
原创粉丝点击