您的位置:首页 > Web前端 > JavaScript

javascript获取css样式文件中定义的样式的方法

2009-11-26 10:03 639 查看
1. //Firefox浏览器支持
2. if (document.defaultView && document.defaultView.getComputedStyle) {
3.    var css = document.defaultView.getComputedStyle(element, null);
4.    value = css ? css[style] : null;
5.  } else if (element.currentStyle) {
6. IE支持.
7.    value = element.currentStyle[style];
8.  }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: