काउंटर बनाने के लिए, काउंटररीसेट . का उपयोग करें जावास्क्रिप्ट में संपत्ति। जावास्क्रिप्ट के साथ एक या अधिक काउंटर बनाने या रीसेट करने के लिए आप निम्न कोड चलाने का प्रयास कर सकते हैं -
उदाहरण
<!DOCTYPE html>
<html>
<head>
<style>
h2:before {
counter-increment: section;
content: counter(section) " Quiz ";
}
</style>
</head>
<body>
<h1>Quizzes</h1>
<p>Change the counterIncrement</p>
<h2>Ruby</h2>
<h2 id="myID">Java</h2>
<h2>PHP</h2>
<h2>Perl</h2>
<button onclick="display()">Reset Counter</button>
<script>
function display() {
document.body.style.counterReset = "section";
}
</script>
</body>
</html>