vendredi 11 mai 2018

button that helps you show an answer

<script>

     var SbnAnswer = document.getElementById('answer').value;

  function SbnAnswer () {

    if (answer === "a map" || "map") {
      var answer = toLowerCase();
      document.getElementById('right').innerHTML="Congratulations, you answered right!";

    }

  else(document.getElementById('wrong').innerHTML="Your answer is wrong.");




    }

</script>

I have mountains - but no rocks, forest - but no trees, river - but no water. I'm here to help you. What am I?

 <input type="text" id="answer"> </button> <button id="SbnAnswer" type="button">Answer</button>

 <p id="right" value="right"></p>

 <p id="wrong" value="wrong"></p>

So, essentially I'm trying to make a button where if the viewer types in an answer in the input field, they would get a

answer down that tells them if they were wrong or right. How do I do this?

Aucun commentaire:

Enregistrer un commentaire