Mega Code Archive

 
Categories / JavaScript DHTML / HTML
 

Get Element style

<!--       Example File From "JavaScript and DHTML Cookbook"      Published by O'Reilly & Associates      Copyright 2003 Danny Goodman --> function getElementStyle(elemID, IEStyleAttr, CSSStyleAttr) {     var elem = document.getElementById(elemID);     if (elem.currentStyle) {         return elem.currentStyle[IEStyleAttr];     } else if (window.getComputedStyle) {         var compStyle = window.getComputedStyle(elem, "");         return compStyle.getPropertyValue(CSSStyleAttr);     }     return ""; }