/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function getStyle(el,styleProp) { var x = document.getElementById(el); if (x.currentStyle) var y = x.currentStyle[styleProp]; else if (window.getComputedStyle) var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp); return y; }
URL: http://www.quirksmode.org/dom/getstyles.html