vendredi 18 novembre 2016

Why aren't my javascript functions running?

I have several functions on my web page that aren't working, here is one -

<input name="choose" type="radio" onclick="changebgcolor('cyan')">"Cyan"
    <input name="choose" type="radio" onclick="changebgcolor('magenta')">"Magenta"
    <input name="choose" type="radio" onclick="changebgcolor('lightsalmon')">"Light Salmon"
    <script>
        function changebgcolor(color){
            if(color=="cyan"){
                document.body.style.backgroundColor = "cyan"
            }
            else if (color == "magenta"){
                document.body.style.backgroundColor= "magenta"
            }
            else (color == "lightsalmon"){
                document.body.style.backgroundColor = "lightsalmon"
            }

        }
    </script>

The other one is a similar function intended to change text color, the rest are form validations. and here is the web page I am working on - http://ift.tt/2fMIzjH

Aucun commentaire:

Enregistrer un commentaire