function getCssValue(selector,attribute) { selector = selector.toLowerCase(); var stylesheet = document.styleSheets[0]; var n = stylesheet.cssRules.length; for(var i=0; i<n; i++) { var selectors = stylesheet.cssRules[i].selectorText.toLowerCase().split(","); var m = selectors.length; for(j=0; j<m; j++) { if(selectors[j].trim() == selector) { var value = stylesheet.cssRules[i].style.getPropertyValue(attribute); if(value!="") { return value; } } } } debug("Could not find selector/attribute: "+selector+"/"+attribute); return null; },
You need to create an account or log in to post comments to this site.