参考:https://blog.csdn.net/qq_23614619/article/details/81075793

js获取class中属性需要的函数obj.currentStyle[attr]和getComputedStyle(element, null)

var oDiv = document.getElementById('div1');   

function getStyle(obj, attr){

    return obj.currentStyle ? obj.currentStyle[attr] : getComputedStyle(obj, false)[attr];

}

getStyle(oDiv, 'width')

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
  • 2021-12-03
  • 2021-12-27
  • 2021-08-09
猜你喜欢
  • 2021-10-10
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
  • 2022-12-23
  • 2022-12-23
  • 2021-05-21
相关资源
相似解决方案