JavierB tiene unas funciones para eso, yo las recopilé todas en un objeto, mira a ver si te sirve:
Código Javascript
:
Ver originalString.prototype.low=function(){ return this.toLowerCase(); };
var extSS = function(){};
extSS.prototype = {
isIE : document.all,
instrucciones : {
'reglas' : this.isIE ? 'rules' : 'cssRules',
'add' : (this.isIE ? 'add' : 'insert') + 'Rule',
'remove' : (this.isIE ? 'remove' : 'delete') + 'Rule'
},
hojas : document.styleSheets,
getSS : function(id){
var cosa;
switch(typeof id){
case 'number' :
return this.hojas[id] ? this.hojas[id] : false;
break;
case 'string' :
for(var url = /(file|http):\/\/(\/*).+\//, i=0; cosa = this.hojas[i]; i++){
if(cosa.href == id || cosa.href.replace(url, '') == id || cosa.href.replace(url, '').replace(/\.css$/, '') == id)
return cosa;
}
break;
}
return false;
},
find : function(select, propi){
var estilo;
for(i=0; sheet = this.hojas[i]; i++){
estilo = sheet[this.instrucciones['reglas']];
for(j=0; regla = estilo[j]; j++){
if(regla.selectorText.low() == select.low() && regla.style[propi])
return regla.style[propi];
}
}
return false;
},
set : function(select, propi, val){
var estilo;
for(i=0; sheet = this.hojas[i]; i++){
estilo = sheet[this.instrucciones['reglas']];
for(j=0; regla = estilo[j]; j++){
if(regla.selectorText.low() == select.low() && regla.style[propi])
regla.style[propi] = val;
}
}
return false;
},
add : function(hoja, select, propi, val){
var SS = this.getSS(hoja);
try{
SS.insertRule(select + '{' + propi + ':' + val + '}', SS[this.instrucciones['reglas']].length);
}catch(e){ // IE
SS.addRule(select, propi + ':' + val);
}
},
remove : function(hoja, select){
var estilo;
switch(typeof hoja){
case 'number' :
estilo = this.hojas[hoja][this.instrucciones['reglas']];
for(i=0; regla = estilo[i]; i++){
if(regla.selectorText.low() == select.low())
this.getSS(hoja)[this.instrucciones['remove']](j);
}
break;
case 'string' :
if(hoja=='all'){
for(i=0; sheet = this.hojas[i]; i++){
estilo = sheet[this.instrucciones['reglas']];
for(j=0; regla = estilo[j]; j++){
if(regla.selectorText.low() == select.low())
sheet[this.instrucciones['remove']](j);
}
}
}else{
var SS = this.getSS(hoja), estilo = SS[this.instrucciones['reglas']];
for(i = 0; regla = estilo[i]; i++){
if(regla.selectorText.low() == select.low())
SS[this.instrucciones['remove']](i)
}
}
break;
}
}
};
var SS = new extSS();
Esto busca por las StyleSheets del documento, así que no te servirá para saber por ejemplo el tamaño de fuente de un párrafo sin ningún estilo (para se usa getComputedStyle() creo), pero si lo tienes definido en algún sitio sí.
Saludos (: