CSSRule.cssText 概述 cssText 返回样式规则所包含的实际文本。想要能够动态的设置一个样式表规则,查看使用动态样式信息。语法string = cssRule.cssText 例子<style> body { background-color: darkblue; } </style> <script> var stylesheet = document.styleSheets[0]; alert(stylesheet.cssRules[0].cssText); // body { background-color: darkblue; } </script> 规范 DOM Level 2 Style CSS - Interface CSSStyleRule (introduced in DOM Level 2)