RuffusJones
Feb 2nd 2008, 9:52 am
I need to make a movie quiz with 3 possible outcomes. when i try loading it, nothing happens, the prompts stopped working when i added the variables at the top. Heres what i have so far.
<script type="text/javascript">
var response1 = "", response2 ="", response3 ="";
var comedy = 5;
var horror = 5;
var action = 5;
function processScore() {
var score = 0 // keeps track of score
response1 = prompt("What is your favorite genre or film?", "Enter here")
if (prompt == comedy){
score = score + 1}
response2 = prompt("What is your favorite movie of all time?", "Enter here")
if (prompt == horror){
score = score + 1}
response3 = prompt("Who is your favotire Actor?", "Anyone but Keanu Reeves")
if (prompt == action){
score = score + 1}
</script>
<form id="answersForm" name ="answersForm">
<input type="button" value="Grade the Quiz!"
onclick="processScore()">
<input type ="text" name ="scoreBox"size="1">
</form>
</body>
<script type="text/javascript">
var response1 = "", response2 ="", response3 ="";
var comedy = 5;
var horror = 5;
var action = 5;
function processScore() {
var score = 0 // keeps track of score
response1 = prompt("What is your favorite genre or film?", "Enter here")
if (prompt == comedy){
score = score + 1}
response2 = prompt("What is your favorite movie of all time?", "Enter here")
if (prompt == horror){
score = score + 1}
response3 = prompt("Who is your favotire Actor?", "Anyone but Keanu Reeves")
if (prompt == action){
score = score + 1}
</script>
<form id="answersForm" name ="answersForm">
<input type="button" value="Grade the Quiz!"
onclick="processScore()">
<input type ="text" name ="scoreBox"size="1">
</form>
</body>