JK Web Studio is a small web design studio, specializing in efficient and user friendly solutions.

Contact us at info@jkwebstudio.com

Using JavaScript to read CSS from external file

function get_style( obj, cssprop ){
if (obj.currentStyle){ // IE
return obj.currentStyle[cssprop];
}else if (document.defaultView && document.defaultView.getComputedStyle){ // DOM
return document.defaultView.getComputedStyle(obj, “”)[cssprop];
}else{ // get inline style
return obj.style[cssprop];
}
}

Leave a Reply