Questo piccolo esempio mostra come recuperare il valore di un attributo di un elemento presente nella pagina a prescindere che la sua definizione sia stata fatta in line o in un foglio css
function getStyle(e, attribute)
{
var outcome
alert(e);
alert(attribute);
if (e.currentStyle)
{
outcome = e.currentStyle[attribute];
}
if (document.defaultView.getComputedStyle)
{
outcome = document.defaultView.getComputedStyle(e,null)[attribute];
}
alert(document.defaultView.getComputedStyle(e,'').getPropertyValue(attribute));
return outcome;
}






