美文网首页
获取css中的属性值

获取css中的属性值

作者: 书童drj | 来源:发表于2017-06-27 11:35 被阅读0次
<script>
  getStyle(ele,attr);
  function getStyle(ele,attr){
    if(window.getComputedStyle){
      return window.getComputedStyle(ele,false)[attr];
     }else{
         //兼容IE
         return ele.currentStyle[attr];
      }
    }

</script>
              

相关文章

网友评论

      本文标题:获取css中的属性值

      本文链接:https://www.haomeiwen.com/subject/xkzscxtx.html