JS 获取元素的属性值,非内联样式

//获取样式表的属性值,IE8及以下不兼容 ,方法
window.getComputedStyle(dom对象,"伪类").style属性;
 
//IE8及以下获取样式表的属性值 ,属性
element.currentStyle.style属性;
 
判断浏览器是否兼容 getComputedStyle 和 currentStyle
if( window.getComputedStyle ){ }
else if( document.body.cyrrentStyle ){ }

 

 
posted @ 2015-09-15 10:01  张小窝  阅读(797)  评论(0编辑  收藏  举报