I'm taking a "self-paced" class trying to learn a little javascript. I'm doing the old Dino Quiz trying to add pop up alerts after a click on a radio button of any question. I only added the javascript functions "scoreQuestion" at the top. The rest was already typed for me to add the functions to. I've added everything that my book has in it exactly as it has it...or so I think. It says I should be receiving the pop up alerts but I'm not. Could someone please look over this and see what I missed. Thank you.

Jake

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Dinosaur Quiz</title>
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS

function scoreQuestion1(answer) {
	if (answer == "a")
		window.alert("Incorrect Answer");
	if (answer == "b")
		window.alert("Correct Answer");
	if (answer ==  "c")	
		window.alert("Incorrect Answer");
	if (answer == "d")
		window.alert("Incorrect Answer");
}

function scoreQuestion2(answer) {
	if (answer == "a")
		window.alert("Incorrect Answer);
	if (answer == "b")
		window.alert("Correct Answer");
	if (answer == "c")
		window.alert("Incorrect Answer");
	if (answer == "d")
		window.alert("Incorrect Answer");
}

function scoreQuestion3(answer) {
	if (answer == "a")
		window.alert("Incorrect Answer);
	if (answer == "b")
		window.alert("Incorrect Answer);
	if (answer == "c")
		window.alert("Correct Answer);
	if (answer == "d")
		window.alert("Incorrect Answer");
}

function scoreQuestion4(answer) {
	if (answer == "a") 
		window.alert("Incorrect Answer);
	if (answer == "b")
		window.alert("Incorrect Answer");	
	if (answer == "c")
		window.alert("Incorrect Answer");
	if (answer == "d")
		window.alert("Correct Answer");
}

function scoreQuestion5(answer) {
	if (answer == "a")
		window.alert("Correct Answer");
	if (answer == "b")
		window.alert("Incorrect Answer");
	if (answer == "c")
		window.alert("Incorrect Answer");
	if (answer == "d")
		window.alert("Incorrect Answer");
}

// STOP HIDING FROM INCOMPATIBLE BROWSERS-->
</script>
</head>
<body>
<h1>Dinosaur Quiz</h1>
<p>Answer all of the questions on the quiz, then select the Score button to grade the quiz. </p>
<form action="">
<p><b>1. What dinosaur was the heaviest?</b></p>
<p><input type="radio" name="question1" value="a"
     onclick="scoreQuestion1('a')" />Tyrannosaurus<br />
<input type="radio" name="question1" value="b"
     onclick="scoreQuestion1('b')" />Brachiosaurus<br /> <!-- correct answer -->
<input type="radio" name="question1" value="c"
     onclick="scoreQuestion1('c')" />Brontosaurus<br />
<input type="radio" name="question1" value="d"
     onclick="scoreQuestion1('d')" />Diplodocus</p>
<p><b>2. When did dinosaurs become extinct?</b></p>
<p><input type="radio" name="question2" value="a"
     onclick="scoreQuestion2('a')" />1 billion years ago<br />
<input type="radio" name="question2" value="b"
     onclick="scoreQuestion2('b')" />65 million years ago<br /> <!-- correct answer -->
<input type="radio" name="question2" value="c"
     onclick="scoreQuestion2('c')" />10 million years ago<br />
<input type="radio" name="question2" value="d"
     onclick="scoreQuestion2('d')" />15,000 years ago</p>
<p><b>3. Which of these is not a dinosaur?</b></p>
<p><input type="radio" name="question3" value="a"
     onclick="scoreQuestion3('a')" />Megalosaurus<br />
<input type="radio" name="question3" value="b"
     onclick="scoreQuestion3('b')" />Apatosaurus<br />
<input type="radio" name="question3" value="c"
     onclick="scoreQuestion3('c')" />Pterodactyl<br />  <!-- correct answer -->
<input type="radio" name="question3" value="d"
     onclick="scoreQuestion3('d')" />Triceratops</p>
<p><b>4. In which period did the Diplodocus live?</b></p>
<p><input type="radio" name="question4" value="a"
     onclick="scoreQuestion4('a')" />Early Cretaceous<br />
<input type="radio" name="question4" value="b"
     onclick="scoreQuestion4('b')" />Early Triassic<br />
<input type="radio" name="question4" value="c"
     onclick="scoreQuestion4('c')" />Late Triassic<br />
<input type="radio" name="question4" value="d"
     onclick="scoreQuestion4('d')" />Late Jurassic</p> <!-- correct answer -->
<p><b>5. Which of the following dinosaurs was a carnivore?</b></p>
<p><input type="radio" name="question5" value="a"
	onclick="scoreQuestion5('a')" />Tyrannosaurus<br />  <!-- correct answer -->
<input type="radio" name="question5" value="b"
	onclick="scoreQuestion5('b')" />Triceratops<br />
<input type="radio" name="question5" value="c"
	onclick="scoreQuestion5('c')" />Stegosaurus<br />
<input type="radio" name="question5" value="d"
	onclick="scoreQuestion5('d')" />Brontosaurus</p>
</form>
</body>
</html>

Line 22, 33, 35, 37, 44 - You forgot to close the quotes

~G

I knew it was going to be something like that. I just couldn't see it for some reason. Thanks for the help and quick response.

Jake

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.