View Single Post
Old 01-02-2013, 11:18 PM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
getComputedStyle is not supported in IE < 9. You could incorporate:

Code:
        var getStyle = function (elem, strRule) {
            // robertnyman.com e.g. "font-size"
            // Note: IE is 'elem.styleFloat' FF is 'elem.cssFloat'
            // Also FF returns pixels for font-size in em, IE returns the 'em' value.

            elem = (typeof elem === 'string') ? document.getElementById(elem) : elem;
            if (document.defaultView && document.defaultView.getComputedStyle ) {
                return document.defaultView.getComputedStyle(elem, '').getPropertyValue(strRule);
            } else if ( elem.currentStyle ) {
                strRule = strRule.replace(/\-(\w)/g, function (strMatch, p1) {
                    return p1.toUpperCase();
                });
                return elem.currentStyle[strRule];
            } else {
                return '';
            }
        };
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote