Új hozzászólás Aktív témák

  • jeges

    senior tag

    válasz Siriusb #2057 üzenetére

    én ezeket használom most:

    function getStyle(oElm, strCssRule){
    try{
    var strValue = "";
    if(document.defaultView && document.defaultView.getComputedStyle){
    strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
    }
    else if(oElm.currentStyle){
    strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
    return p1.toUpperCase();
    });
    strValue = oElm.currentStyle[strCssRule];
    }
    var num = strValue.replace(/[\sa-z]+/gi, '');
    var str = strValue.replace(/[\d\.]+/i, '');
    return [parseFloat(num), str];
    }catch(er){return [0,"px"];}
    }

    function setStyle(obj,st,vl){
    var a = obj.style.cssText;
    obj.style.cssText = (a.length>0) ? a + ";" + st + ":" + vl : st + ":" + vl ;
    }

    function removeStyle(obj,st){
    str = new RegExp("(?:\\b|^)" + st + "\\s?:[^;]*(?:$|;)", "i");
    obj.style.cssText = obj.style.cssText.replace(str, "");
    }

    ie6+, ff, opera, chrome megette eddig.

Új hozzászólás Aktív témák

Hirdetés