js获取页面引用的css样式表中的属性值方法(推荐)
时间:2021-07-17 08:10:01|栏目:JavaScript代码|点击: 次
如下所示:
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写的放大镜效果
栏 目:JavaScript代码
下一篇:js 动态创建 html元素
本文标题:js获取页面引用的css样式表中的属性值方法(推荐)
本文地址:http://www.codeinn.net/misctech/158343.html






