js兼容

一、获取计算后的样式,也叫当前样式、最终样式。

  currentStyle     VS     getComputedStyle

let oObj = document.getElementById("div");
function isStyle (oObj,oStyle) {
    if (oObj.currentStyle) {
        //IE、Opera
        return oObj.currentStyle[oStyle];
    } else {
        //FF、chrome、safari
        return window.getComputedStyle(oObj,false)[oStyle];
    }
}
View Code

 http://www.mming.cc/blog/?p=549https://www.cnblogs.com/leejersey/archive/2012/08/16/2642604.html

二、document.body    VS    document.documentElement

let a = document.body.scrollWidth || document.documentElement.scrollWidth,

     b = document.body.scrollHeight || document.documentElement.scrollHeight;

https://blog.csdn.net/qq_26445509/article/details/51153153

https://www.cnblogs.com/lidabo/archive/2012/04/27/2473084.html

原文地址:https://www.cnblogs.com/lgyong/p/9245797.html