0
I’m trying to make a progressive counter in the style of the Impostometer, but it’s a non-monetary amount, just a unit. At the moment this is my code:
<html>
<head>
<title>Teste Contador</title>
</head>
<script src="vendor/jquery.js"></script>
<body onload="startCountdown()">
<?php
date_default_timezone_set('America/Sao_Paulo');
$n = 180000;
$cur_time = time();
$orig_time = strtotime("2019-02-18 9:00:00");
$x = $n + ceil((abs(time() - strtotime("2019-02-18 9:23:00"))) / (533 + 1/3));
?>
<script>
var g_iCount = new Number();
var g_iCount = <?= $x ?>;
function startCountdown(){
if((g_iCount - 1) >= 0){
g_iCount = g_iCount + 1;
numberCountdown.innerText = g_iCount;
setTimeout('startCountdown()',1000);
};
};
</script>
<div class="numberCountdown">
<div id="numberCountdown"></div>
</div>
<style>
.numberCountdown {
color: #0000ff;
}
</style>
</body>
The problems I’m facing are: 1- I would like not to use "onload='startCountdown()'" in the "body" tag; 2- I would like to place a filter of hundred, thousand, millions, etc.(123.456.789); Any lack of information just mention that I edit the post as soon as possible.
For some reason he’s adding 2-in-2.
– Rafael Breno
Edit1: It was my mistake, I was pulling the function twice.
– Rafael Breno
If my answer solved your problem click the button next to it to accept it
– Costamilam