codice:
function elenca_rules()
{
    var styles = document.styleSheets;
    if(!styles) return;
    
    var n = styles.length; //1 foglio di stile
    var stile = styles[0];
    
    var rules = (stile.rules)? stile.rules : stile.cssRules;//IE, altri
    if(!rules) return;
    var nrs = rules.length;
    var txt = "<table border='1' style='border-collapse: collapse;'>";
    for(var i = 0; i < nrs; i++)
    {
        var rule = rules[i];
        var cssText = (rule.style.cssText)? rule.style.cssText : rule.cssText//IE, altri    
        txt += "<tr>"
            + "<td valign='top'>" + i + "</td><td valign='top'> " + rule.selectorText + "</td><td>" + cssText + "</td>"
            + "</tr>";
    }
    txt += "</table>";
    document.getElementById("div1").innerHTML = txt;
    

}