Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
AB3462461320878 authored Oct 22, 2023
1 parent 4f56eba commit a136171
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -362,26 +362,18 @@ <h1 style="text-align: center; color: white; font-family: raleway;">Pictures fro
<p class="Costumer-message" style="font-weight: bold;">Thank you User Number : <span id="userCount" style="font-weight: bold;">Loading...</span> For visiting Us</p>

<script>
// Function to increment 'x' when the webpage loads
function incrementXAndDisplay() {
// Include the js.js file
var script = document.createElement('script');
script.src = 'js.js';
document.head.appendChild(script);

// Once the script is loaded, access and update the 'x' variable
script.onload = function() {
if (typeof x !== 'undefined') {
// Increment 'x' by one
x += 1;
// Update the message with the new 'x' value
document.getElementById('userCount').textContent = x;
function updateUserCount() {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("usercount").textContent = this.responseText;
}
};
xhttp.open("GET", "updateUserCount.php", true);
xhttp.send();
}

// Call the function when the webpage is loaded
window.addEventListener('load', incrementXAndDisplay);

updateUserCount();
</script>


Expand Down

0 comments on commit a136171

Please sign in to comment.