Skip to content

Commit

Permalink
visits
Browse files Browse the repository at this point in the history
  • Loading branch information
tanmoy-12 committed Mar 25, 2024
1 parent bbe9854 commit 83b0195
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
34 changes: 12 additions & 22 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,9 @@ <h2>Get UP and Join US Today!</h2>
<div class="visitor">
<!-- Footer Content -->
<p>Total No of Visitors</p>
<h1><span id="visitorCount">0</span></h1>
<!-- hitwebcounter Code START -->
<a href="https://www.hitwebcounter.com" target="_blank">
<img src="https://hitwebcounter.com/counter/counter.php?page=12230927&style=0006&nbdigits=7&type=ip&initCount=0" title="Counter Widget" Alt="Visit counter For Websites" border="0" /></a>

</div>
</footer>
Expand All @@ -433,27 +435,15 @@ <h1><span id="visitorCount">0</span></h1>
defer>
</script>
<script>

// Function to increment visitor count
function incrementVisitorCount() {
let count = localStorage.getItem('visitorCount');
count = count ? parseInt(count) + 1 : 1;
localStorage.setItem('visitorCount', count);
document.getElementById('visitorCount').textContent = count;
}

// Check if visitor count exists in local storage
if (localStorage.getItem('visitorCount')) {
// If exists, retrieve and display
document.getElementById('visitorCount').textContent = localStorage.getItem('visitorCount');
} else {
// If not exists, set initial count to 0 and display
localStorage.setItem('visitorCount', 0);
document.getElementById('visitorCount').textContent = 0;
}

// Call function to increment visitor count
incrementVisitorCount();
const count1 = document.getElementsByClassName(".count");
countvisits();
function countvisits(){
fetch("")
.then((res)=>res.json())
.then((res)=>{
count1.innerHTML = res.value;
});
}
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
Expand Down
4 changes: 2 additions & 2 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1058,8 +1058,8 @@ footer{
text-align: center;
margin: 0 auto;
padding: 15px;
background-color: #000d1a;
color: #ffffff;
background-color: #bfbfbf;
color: #c68700;
}

.visitor p{
Expand Down

0 comments on commit 83b0195

Please sign in to comment.