»
EnglishFrenchVietnamese

Print - Trivia Questions - JavaScriptBank.com

Full version: jsB@nk » Game » Trivia Questions
URL: https://www.javascriptbank.com/trivia-questions.html

Trivia Questions © JavaScriptBank.comAnswer the question correctly to advance to the next round. Includes a hidden form system that prevents the user from jumping to different questions.

Full version: jsB@nk » Game » Trivia Questions
URL: https://www.javascriptbank.com/trivia-questions.html



JavaScript
<script language="JavaScript">// Jeremy Greenfield ([email protected] )<!-- Beginfunction Round1(){Q1=prompt("Who invented the lightbulb?","Your Answer Here");if (Q1=="Thomas Edison"){alert("Correct!")document.verify.Question2.value="Granted"}else{alert("Incorrect! Try Again.")}}function Round2(){Q2=prompt("In science, H202 was one molecule of what?","Your Answer Here \(lower case\)")if (Q2=="hydrogen peroxide"){alert("Correct!")document.verify.Question3.value="Granted"}else{alert("Incorrect! Try Again.")}}function Round3(){Q3=prompt("Which state has the longest sea border?","Your Answer Here")if (Q3=="Alaska"){alert("Correct!")document.verify.Question4.value="Granted"}else{alert("Incorrect! Try Again.")}}function Round4(){Q4=prompt("The theory E=MC2 was made by whom?","Your Answer Here")if (Q4=="Albert Einstein"){alert("Correct!")document.verify.Question5.value="Granted"}else{alert("Incorrect! Try Again.")}}function Round5(){Q3=prompt("What is 12 to the third power? Do not use a calculator!","Your Answer Here \(do not include comma\)")if (Q3=="1728"){alert("Correct!")alert("You answered every question correctly! Congrats! \n\n\n\n\n\n\n\n\n Created By Jeremy Greenfield")alert("Thanks for playing!")}else{alert("Incorrect! Try Again.")}}function PendRound2(){if (document.verify.Question2.value=="Granted"){Round2()}if (document.verify.Question2.value=="Denied"){alert("You must answer the previous rounds correctly before advancing to this round.") }}function PendRound3(){if (document.verify.Question3.value=="Granted"){Round3()}if (document.verify.Question3.value=="Denied"){alert("You must answer the previous rounds correctly before advancing to this round.") }}function PendRound4(){if (document.verify.Question4.value=="Granted"){Round4()}if (document.verify.Question4.value=="Denied"){alert("You must answer the previous rounds correctly before advancing to this round.") }}function PendRound5(){if (document.verify.Question5.value=="Granted"){Round5()}if (document.verify.Question5.value=="Denied"){alert("You must answer the previous rounds correctly before advancing to this round.") }}//  End --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name="verify"><input type="hidden" name="Question2" value="Denied"><input type="hidden" name="Question3" value="Denied"><input type="hidden" name="Question4" value="Denied"><input type="hidden" name="Question5" value="Denied"><input type="button" value="Round 1" name="R1" style="color: rgb(0, 0, 255); font-family: Courier New;" onclick="Round1()"><input type="button" value="Round 2" name="R3" style="color: rgb(0, 0, 255); font-family: Courier New;" onclick="PendRound2()"><input type="button" value="Round 3" name="R3" style="color: rgb(0, 0, 255); font-family: Courier New;" onclick="PendRound3()"><input type="button" value="Round 4" name="R4" style="color: rgb(0, 0, 255); font-family: Courier New;" onclick="PendRound4()"><input type="button" value="Round 5" name="R5" style="color: rgb(0, 0, 255); font-family: Courier New;" onclick="PendRound5()"></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->