编辑下面的代码:【加编码】
<html> <head> <style> h1:before { counter-increment:section; content:"第 " counter(section) " 部分:"; } </style> </head> <body> <p>点击“尝试一下”按钮设置 BODY 元素的 counter-reset 属性:</p> <button onclick="myFunction()">尝试一下</button> <h1>HTML 教程</h1> <h1>JavaScript 教程</h1> <h1>CSS 教程</h1> <script> function myFunction() { document.body.style.counterReset="section"; } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂