/ Published in: JavaScript

Gets the style property as rendered, not as defined (which can be different).
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function measure(el, styleProp) { if (el.currentStyle) var st = el.currentStyle[styleProp]; else if (window.getComputedStyle) var st = document.defaultView.getComputedStyle(el, null).getPropertyValue(styleProp); return st; }
URL: http://www.quirksmode.org/dom/getstyles.html
Comments
