Gets the style css

To get all the style, you must use the following method

Support node.currentStyle. In IE style name (node ​​represents an element node)

In Firefox in getComputedStyle (node) style

function getStyle(){
        if(node.currentStyle){
           //说明是IE
          return node.currentStyle[styleName];
      }else{
          return getComputedStyle(node)[styleName];
}
}

Guess you like

Origin www.cnblogs.com/itfz/p/10978426.html