2
When he gets to the "end" and I want him to change color, he can tell me how to do it ?
<!DOCTYPE html>
<html>
<head>
<title>javascript</title>
<meta charset="utf-8">
<link type="text/css" rel="stylesheet" media="screen" href="style.css" />
<script type="text/javascript">
var count = new Number();
var count = 60;
function start(){
if ((count - 1) >= 0){
count -= 1;
if (count == 0) {
count = "Atualizado";
}else if(count < 10){
count = "0"+count;
}
tempo.innerText=count;
setTimeout('start();', 100);
}
}
</script>
</head>
<body onload="start();">
<div id="tempo" ></div>
</body>
</html>
Reedit your question, please.
– Marcelo Shiniti Uchimura
To change the color of the div #tempo Voce will need to access it at the end of the loop and inject the new background. You can use Document.querySelector("#time").style.background = "blue"
– lucasferreiralimax
The countdown running on Jsfiddle The count to my specifications
– Romero Souza