Published in: JavaScript
Reading the style of an element in your document isn't as simple as it should be. Here a solution. Background information here: http://www.oreillynet.com/pub/a/javascript/excerpt/JSDHTMLCkbk_chap5/index5.html Script from here: http://www.quirksmode.org/dom/getstyles.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; }
You need to login to post a comment.
