js获取页面引用的css样式表中的属性值方法(推荐)

时间:2016-08-19    点击:116   

如下所示:

function getStyle(node, property){

      if (node.style[property]) {
        return node.style[property];

      } 
      else if (node.currentStyle) {
        return node.currentStyle[property];
      } 
      else if (document.defaultView && document.defaultView.getComputedStyle) {
        var style = document.defaultView.getComputedStyle(node, null);
        return style.getPropertyValue(property);
      }

      return null;

    }

以上这篇js获取页面引用的css样式表中的属性值方法(推荐)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持本站。

js enter键激发事件实例代码
js替换字符串中所有指定的字符(实现代码)
在javascript中使用com组件的简单实现方法
模拟javascript中的sort排序(简单实例)
js replace(a,b)之替换字符串中所有指定字符的方法
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved