jS从样式表取值的函数。IE中以currentStyle,firefox中defaultView来获取

DOM.style仅仅能读到写在html中的样式值

获取样式值的函数

function returnStyle(obj,styleName){
var myObj = typeof obj =="string" ?

document.getElementById(obj) : obj; if(document.all){ return eval("myObj.currentStyle."+ styleName); } else { returneval("document.defaultView.getComputedStyle(myObj,null)." +styleName); } }



相关文章:

  • 2021-04-05
  • 2022-12-23
  • 2022-12-23
  • 2021-05-10
  • 2019-09-01
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
猜你喜欢
  • 2022-12-23
  • 2021-12-04
  • 2021-04-08
  • 2018-10-22
  • 2021-06-06
  • 2019-11-13
相关资源
相似解决方案