.style, .getComputedStyle(),.currentStyle区别

1)style只能获取行间样式(写在标签里面的);能读能写

2)currentStyle是专属ie的属性,区别他返回的是最终样式 及包括行间和外链css

3)getComputedStyle是一个可以获取当前元素所有最终使用的CSS属性值;只读

因此:

行间样式可以直接用style;其他可用函数

 var oStyle = this.currentStyle? this.currentStyle : window.getComputedStyle(this, null);
    alert(oStyle.height);
原文地址:https://www.cnblogs.com/chabai/p/5230049.html