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>
Separate them to 3 vars. As for the rest...wtf?. response3 = prompt("Who is your favotire Actor?", "Anyone but Keanu Reeves") if (prompt == action){ score = score + 1} Code (markup): . To me that makes little sense. If action = 5, then that means you must enter 5 into te prompt?. That code doesn't look like it will do anything at all. Can you please tell me what you want to happen when you hit the button?
Your right my code is pretty iced out on meth. Luckily i figured out the problem on my own...sort of but thanx for replying .