<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”UTF-8″>
<title>Dynamic Visit Counter</title>
<script>
function incrementCounter() {
let count = parseInt(localStorage.getItem(‘visitCount’)) || 0;

// Update every 2 seconds by 3,800
setInterval(() => {
count += 3800;
localStorage.setItem(‘visitCount’, count);
document.getElementById(“visitCounter”).innerText = count.toLocaleString();
}, 2000); // 2,000 milliseconds = 2 seconds

// Continue updating every hour by 4,000,000
setInterval(() => {
count += 4000000;
localStorage.setItem(‘visitCount’, count);
document.getElementById(“visitCounter”).innerText = count.toLocaleString();
}, 3600000); // 3,600,000 milliseconds = 1 hour
}

function displayCounter() {
let count = parseInt(localStorage.getItem(‘visitCount’)) || 0;
document.getElementById(“visitCounter”).innerText = count.toLocaleString();
}

window.onload = () => {
displayCounter();
incrementCounter();
};
</script>
</head>
<body>
<h1>Website Visits</h1>
<p>Number of visits: <span id=”visitCounter”>0</span></p>
</body>
</html>

Recent posts

Quote of the week

"People ask me what I do in the winter when there's no baseball. I'll tell you what I do. I stare out the window and wait for spring."

~ Rogers Hornsby
Design a site like this with WordPress.com
Get started