首页 > 其他 > 详细

Computed Styles

时间:2015-06-06 17:45:56      阅读:276      评论:0      收藏:0      [点我收藏+]

 

The style object offers no information about the styles that have cascaded from style sheets and affect the element. DOM Level 2 provide a method called getComputedStyle(). This method accepts two arguments: the element to get the computed style for and a pseudo-element string (such as ":after"). The second argument can be null if no pseudo-element information is necessary.  IE doesn‘t support getComputedStyle(), though it has a similar concept. Every element that has a style property also has a currentStyle property.

1 function getStyle(obj, name) {
2     if (obj.currentStyle) { 
3         return obj.currentStyle[name];
4     } else {
5         return getComputedStyle(obj, null)[name];
6     }
7 }    

 

Computed Styles

原文:http://www.cnblogs.com/linxd/p/4556833.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!