samedi 25 juin 2016

How to check information from checkbox

How to get and check information from checkbox? I have checkbox:

<form action="handler.php">
  <p><b>a or b or c</b></p>
  <p><input type="radio" id="abc" name="answer" value="a1">1<Br>
  <input type="radio" id="abc" name="answer" value="a2">2<Br>
  <input type="radio" id="abc" name="answer" value="a3">3</p>

 </form>

And i want to check information and if i find that box (with value a1 for example) is checked then i need to show a picture:

<script>
function ShowPicture() {

  var word = document.getElementById("abc").value;
  if(word == "a1") {
  document.getElementById("demo").innerHTML = '<iframe src="http://ift.tt/290iPjc" width="1024" height="720" align="left">';
  } 
}

</script>

Where is mistake?

Thanks a lot for help!




Aucun commentaire:

Enregistrer un commentaire