IE9和其他浏览器(IE9+,FF,Chrom,Safari,Opera)
window.getComputedStyle(element,null).getPropertyValue('属性名');
不支持驼峰写法;表示获取实际表现的样式属性值;
IE6~IE8
element.currentStyle.getAttribute("float");
注意
- element.getAttribute("id");来获取元素的特性,不存在时返回null或是"";
- cssStyleDeclaration.getPropertyValue() 返回一个包含特定的css property的值的字符串;