mardi 19 octobre 2021

else if statement declaration or statement expected [closed]

im trying to get this else if statement to work using JavaScript, my thinking is that something is wrong with the parenthesis but I cannot for the life of me figure out what.

function test() {

    var visanum = document.getElementById("visanum")
    var cardtype = document.getElementById("cardType")
    var masterCard = document.getElementById("MasterCard")
    var visa = document.getElementById("Visa")
    var masternum = document.getElementById("masternum")

    if ((cardtype.onchange == visa)); {
        visanum.style.display = "block";
        masternum.style.display = "none";
    } else if ((cardtype.onchange == masterCard)); {
        visanum.style.display = "none";
        masternum.style.display = "block";
    }
    

}

Aucun commentaire:

Enregistrer un commentaire