<html>
<head>
<style>
h1 {counter-increment:section;}
h1:before
{
content:"第 " counter(section) " 部分:";
}
</style>
</head>
<body>
<h1>HTML 教程</h1>
<h1 id="myH1">CSS 教程</h1>
<h1>JavaScripts 教程</h1>
<p>点击“尝试一下”按钮改变第二个 H1 元素的 counterIncrement:</p>
<button onclick="myFunction()">尝试一下</button>
<script>
function myFunction()
{
document.getElementById("myH1").style.counterIncrement = "subsection";
}
</script>
</body>
</html>