如何使用JavaScript读取CSS规则值?
.style.width
.test { width:80px; height:50px; background-color:#808080;}
function getStyle(className) { var classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules for(var x=0;x<classes.length;x++) { if(classes[x].selectorText==className) { //this is where I can collect the style information, but how? } }}getStyle('.test')