Multiple Choice Question Javacript HTML


<form name="form">1) Question 1<div class="qselections"><button type="button" onclick="cek1()" >A</button> Answer 1<br><button type="button" onclick="cek2()" >B</button> Answer 1<br><button type="button" onclick="cek3()" >C</button> Answer 1<br><button type="button" onclick="cek4()" >D</button> Answer 1<br>Jawaban anda :<input type="text" name="angka1" size="1"><br></form><br><button type="button" onclick="cekjawaban()" >Check Answer</button><br><h3 id="tampil"></h3><script>function cek1(){form.angka1.value= "A";}function cek2(){form.angka1.value= "B";}function cek3(){form.angka1.value= "C";}function cek4(){form.angka1.value= "D";}function cekjawaban(){if(form.angka1.value=='A'){document.getElementById("tampil").innerHTML="Well Done";}else{document.getElementById("tampil").innerHTML="Ouh No!, Try Again";}}</script>

 DEMO :
1) Question 1
Answer 1
Answer 1
Answer 1
Answer 1
Jawaban anda :



Search in This Blog