bonjour à tous et à toutes,

je suis novice dans la programmation, j'ai un countDownTimer pour 24H avec un code promotion chaque jour, sur un thème pour mon site que j'ai acheter, alors mon souhait et de choisir le jour la durée et de l'offre à mettre.


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function countDownTimer(){
// Set the date we're counting down to
var countDownDate = new Date();
countDownDate.setHours(23,59,59,999);
// Update the count down every 1 second
var x = setInterval(function() {
 
    // Get todays date and time
    var now = new Date().getTime();
    var day = new Date().getDay();
 
    var discountsWithText = [
                             { text: "" },
                             { text: "" },
                             { text: "LES OFFRES DU SUPER MARDI SONT LÀ! PREND 10% DE RÉDUCTION EN PLUS AVEC NOTRE COLLECTIONS MAISON & OBJETS LE CODE : ", code: " SUPER " },
                             { text: "" },
                             { text: "" },
                             { text: "" },
                             { text: "OFFRE LIMITÉE DU WEEK-END! PREND 20% DE RÉDUCTION EN PLUS AVEC NOTRE COLLECTIONS BIEN & ETRE AVEC LE CODE : ", code: " WKND20 " },
                            ]
 
    var displayText = discountsWithText[day]["text"]
    var displayCode = discountsWithText[day]["code"]
 
    // Find the distance between now an the count down date
    var distance = countDownDate - now;
 
    // Time calculations for days, hours, minutes and seconds
    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
 
    // Output the result in an element with id="demo"
    document.getElementById("countdownCollection").innerHTML = displayText + "<font color='#D20120;'>" + displayCode + "</font color><br>" + " LA FIN DE NOTRE OFFRE DANS  " + "<font color='#D20120;'>" + hours + "h " + minutes + "m " + seconds + "s " + "</font color>";
 
    // If the count down is over, write some text 
    if (distance <0) {
      countDownTimer();
    }
}, 1000);
}
 
countDownTimer();
</script>
merci de votre aide