Dear friend, I support what our colleague fredyfx says, it would be good if you could see a tour of the portal so that you can issue your queries in more detail and thus be able to help you better. However, I found on the web a code that does what you want, I modified it to be like the description you mentioned about what you want it to do. It is not more than a script that runs every one second removing in this unit a number of seconds that you place and change the innerHTML of a paragraph
, so that it shows every second a time update. When it reaches zero, place another message, in that part you can execute the function you deem appropriate.
I hope the code that I leave can help you.
Greetings and that you find good knowledge.
<!DOCTYPE HTML>
<html>
<head>
<style>
p {
text-align: center;
font-size: 60px;
}
</style>
</head>
<body>
<p id="demo"></p>
<script>
var segundos = 10;
// Actualiza los segundos cada un segundo
var x = setInterval(function() {
//Cambia el contenitdo del elemento con el id "demo"
document.getElementById("demo").innerHTML = "Quedan "+ segundos + " segundos ";
//Se resta una unidad cada vez que pasa por aqui.
segundos--;
//Cuando se acabe el contador va a ejecutar la función que le coloques dentro del if.
if (segundos < 0) {
clearInterval(x);
document.getElementById("demo").innerHTML = "INICIANDO DESCARGA ...";
}
}, 1000);
</script>
</body>
</html>