Non-line style cases
#div1 { width: 200px; height: 200px; background: red;}IE gets non-line styles
var oDiv = document.getElementById('div1'); oDiv.currentStyle.width; Chrome/FF gets non-line style var oDiv = document.getElementById('div1'); oDiv.getComputedStyle(oDiv,false).width;My compatibility writing
var oDiv = document.getElementById('div1');var eleWidth = oDiv.currentStyle && oDiv.currentStyle.width || getComputedStyle(oDiv,false).width;My Extension
function getStyle(obj,name){ return obj.currentStyle?obj.currentStyle[name]:getComputedStyle(obj,false)[name];}==Note== The above can only obtain non-line styles, and cannot set values for non-room styles.
The above is the full description of JavaScript compatibility summary introduced by the editor to obtain non-line styles. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time!