Javascript Clock Condition

how do i get both of my variable condition to work at the same time?


Il est <span id="une"> Une 

<span id="deux"> Deux
<span class="trois"> trois 
<span id="quatre"> quatre
<span id="cinq"> cinq 
<span id="six"> six 
<span id="sept"> sept 
<span id="huit"> huit 
<span id="neuf"> neuf 

heure

<span id="midi"> Midi 
<span id="minuit"> Minuit 

<span class="dix"> Dix 
<span id="quart"> Et quart 
<span id="demi"> Et-Demi 
<span id="vingt"> une 
<span id="moinscinq"> moins cinq 
<span id="moinsvingt"> moins vingt 
</span>

</div>

<script >
var min= new Date().getMinutes();

if (min >=0 && min <= 5) {
document.getElementById("cinq").style.color="blue";
}
else if ( min >=5 && min <15 ){
document.getElementById("quart").style.color="green";
}
else if ( min >= 15 && min <30 ){
document.getElementById("Et-Demi").style.color="green";
}
else if ( min >= 30 && min <40 ){
document.getElementById("moinsvingt").style.color="green";
}else if ( min >= 40 && min <55 ){
document.getElementById("moinsvingt").style.color="blue";
}else if ( min >= 55 && min <59 ){
document.getElementById("moinscinq").style.color="green";
}
</script>
<script>
var time = new Date().getHours();
if (time = 13) {
document.getElementById("une").style.color= "blue";
} else {
document.getElementById("deux").style.color= "blue";
</script>

The second condition doesn’t work because you forgot to close the else condition. Also, you haven’t closed any of those spans.

1 Like

had not taken into account … thanks !!!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.