topical media & game development
basic-javascript-08-Quiz-AskQuestion.htm / htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Ask Questions</title>
<script language="JavaScript" type="text/javascript">
var globalFunctions;
globalFunctions = window.top.fraTopFrame.fraGlobalFunctions;
function getAnswer()
{
var answer = 0;
if (document.QuestionForm.elements[0].type == "radio")
{
while (document.QuestionForm.radQuestionChoice[answer].checked != true)
answer++;
answer = String.fromCharCode(65 + answer);
}
else
{
answer = document.QuestionForm.txtAnswer.value;
}
return answer;
}
function buttonCheckQ_onclick()
{
var questionNumber = globalFunctions.currentQNumber;
if (globalFunctions.answerCorrect(questionNumber,getAnswer()) == true)
{
alert("You got it right");
}
else
{
alert("You got it wrong");
}
window.location.reload();
}
</script>
</head>
<body style="background-color: #000033;">
<table align=center border="2" width="70%">
<tr>
<td bgcolor=RoyalBlue>
<form name="QuestionForm">
<script language=JavaScript>
document.write(globalFunctions.getQuestion());
</script>
</form>
</td>
</tr>
</table>
</body>
</html>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.