mardi 8 septembre 2015

else if condition ignored?

I'm fairly new to java and am trying to make something that allows people to access information about something that I like. E.g MLP or HoO, but my else if conditions seem to be ignored after the first else if.

var infoChoice = prompt("MLP, PJ&tO, or HoO?")
if (infoChoice != "MLP")
{
    if (infoChoice != "PJ&tO")
    {
        if (infoChoice != "HoO")
        {
        confirm(infoChoice + " is not a valid option.")
    }
}
}

else if (infoChoice = "MLP")
{
confirm("MLP stands for My Little Pony. The 4th generation of MLP, known as MLP:FIM, (My Little Pony: Friendship is Magic) is by far the most well-known and beloved generation.")
}
else if (infoChoice = "HoO")
{
    confirm(infoChoice + " has been registered successfully.")
}

When I run it and search MLP it does fine, but any other "valid" option doesn't work. Please help, this is extremely frustrating.

Aucun commentaire:

Enregistrer un commentaire