x
 
<!DOCTYPE html>
<html>
<head>
<style>
h1 {
  counter-increment: section;
}
h1:before {
  content: "Section " 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>