mardi 29 janvier 2019

how could I display more than one if/else to one ID?

say two of the if statements below are true, how could I make them write to the same tag at different times.

if (a===b) {
        document.getElementById("LW").innerHTML = "statement 1"
    }
else  if (c===d) {
        document.getElementById("LW").innerHTML = "statement 2"
    }
else  if (e===f) {
        document.getElementById("LW").innerHTML = "statement 3";
    }
else {
        document.getElementById("LW").innerHTML = "";
    }

It would go to this

<p id="LW"></p>

for example, if two of the if statements were true, could it be possible to have one statement write to the p tag for 3 seconds, then display the next true statement? maybe a function or setTimer?

i have tried many ideas and searched all over but I can't seem to figure this one out! any help would be great! thanks in advance, I can try to explain further if necessary!

Aucun commentaire:

Enregistrer un commentaire