简单教程
提交运行
代码编辑器:
<script> function displayResult() { alert(document.getElementById("p1").style.cssText); } </script> <p id="p1" style="border:2px dashed green;color:red;">This is a paragraph.</p> <br> <button type="button" onclick="displayResult()">Get the style declaration as a string</button>
运行结果: