178 lines
4.8 KiB
HTML
178 lines
4.8 KiB
HTML
<html>
|
|
|
|
<!-- Mirrored from dsiexplorer.awardspace.biz/MathQuiz/index.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 11 Jul 2023 21:30:02 GMT -->
|
|
<head>
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<meta name="viewport" content="width=device-width" />
|
|
|
|
<title>Math Quiz</title>
|
|
|
|
|
|
<style>
|
|
body { margin: 0px; }
|
|
#top_screen { width: 240px; height: 176px; overflow: hidden; }
|
|
#bottomscreen { padding-top: 77px; height: 99px; }
|
|
#title { position: absolute; left: 14px; top: 65px; }
|
|
#beta { position: absolute; left: 20px; top: 105px; font-size: 14px; font-family: sans-serif; font-weight: bold; font-style: italic; color: #DDDDDD; }
|
|
#ad { position: absolute; width: 240px; height: 60px; top: 193px; left: 0px; }
|
|
#navbar { position: absolute; width: 240px; height: 13px; padding-top: 2px; padding-bottom: 2px; top: 176px; left: 0px; background-color: black; }
|
|
#navbar a { margin-right: 10px; }
|
|
#leftnav { float: left; padding: 0px; border: 0px; margin-left: 1px; margin-right: 1px;}
|
|
#rightnav { float: right; padding: 0px; border: 0px; margin-left: 1px; margin-right: 1px;}
|
|
#container { width: 214px; height: 96px; overflow: hidden; margin-left: 1px; margin-right: 1px; }
|
|
.subcontainer { width: 214px; height: 96px; margin: 0px; }
|
|
.gamelink { background: url(images/bg.html) repeat-x; height: 24px; border: outset 2px; text-align: center; padding-top: 4px; }
|
|
.gamelink img { height: 20px; }
|
|
</style>
|
|
|
|
|
|
<SCRIPT LANGUAGE="JavaScript">
|
|
<!-- Original: Anja Henseler -->
|
|
<!-- Web Site: http://www.hens.com/binoculars -->
|
|
|
|
<!-- This script and many more are available free online at -->
|
|
<!-- The JavaScript Source!! http://javascript.internet.com -->
|
|
|
|
<!-- Begin
|
|
correct=0;
|
|
wrong=0;
|
|
|
|
function random(maxValue) {
|
|
day= new Date();
|
|
hour= day.getHours();
|
|
min=day.getMinutes();
|
|
sec=day.getSeconds();
|
|
mili=day.getTime()
|
|
return(((hour*3600)+(min*60)+(sec)+mili) % maxValue);
|
|
}
|
|
function ranom(maxValue) {
|
|
day= new Date();
|
|
mil=day.getTime();
|
|
return((mil) % maxValue);
|
|
}
|
|
|
|
function add() {
|
|
if(document.quizform.arithmetic[0].checked)
|
|
maxValue=10;
|
|
else {
|
|
if(document.quizform.arithmetic[1].checked)
|
|
maxValue=30;
|
|
else {
|
|
maxValue=60;
|
|
}
|
|
}
|
|
numA=random(maxValue);
|
|
numB=ranom(maxValue);
|
|
numC=numA + numB;
|
|
Answer=window.prompt( numA + "+" + numB + " = ", "");
|
|
ans();
|
|
}
|
|
function subtract() {
|
|
if(document.quizform.arithmetic[0].checked)
|
|
maxValue=10;
|
|
else
|
|
{if(document.quizform.arithmetic[1].checked)
|
|
maxValue=30;
|
|
else {
|
|
maxValue=60
|
|
}
|
|
}
|
|
numA=random(maxValue);
|
|
numB=ranom(maxValue);
|
|
numC=numA - numB;
|
|
Answer=window.prompt( numA + "-" + numB+ " = ", 0);
|
|
ans()
|
|
}
|
|
function divide() {
|
|
if(document.quizform.arithmetic[0].checked)
|
|
maxValue=10;
|
|
else {
|
|
if(document.quizform.arithmetic[1].checked)
|
|
maxValue=30;
|
|
else {
|
|
maxValue=60
|
|
}
|
|
}
|
|
numA=random(maxValue)+1;
|
|
numB=ranom(maxValue)+1;
|
|
numC=numA / numB;
|
|
numC=Math.round(numC)
|
|
window.alert("Please round your answer off:\n"
|
|
+".5 or higher rounds one number up\n"
|
|
+".4 or lower rounds one number down");
|
|
Answer=window.prompt( numA + "/" + numB + " = ", 0);
|
|
ans()
|
|
}
|
|
function multiply() {
|
|
if(document.quizform.arithmetic[0].checked)
|
|
maxValue=10;
|
|
else {
|
|
if(document.quizform.arithmetic[1].checked)
|
|
maxValue=30;
|
|
else {
|
|
maxValue=60
|
|
}
|
|
}
|
|
numA=random(maxValue);
|
|
numB=ranom(maxValue);
|
|
numC=numA * numB;
|
|
Answer=window.prompt( numA + "x" + numB + " = ", 0);
|
|
ans();
|
|
}
|
|
function check() {
|
|
if ((correct+wrong) != 0) {
|
|
score = "" + ((correct / (correct + wrong)) * 100);
|
|
score = score.substring(0,4) + "%";
|
|
alert("YOUR SCORE: " + score + "\n"
|
|
+ correct + " correct\n"
|
|
+ wrong + " incorrect")
|
|
}
|
|
else alert("You have not completed any exercises yet.");
|
|
}
|
|
function ans() {
|
|
if (Answer == numC) {
|
|
correct++;
|
|
msg = "Congratulations, your answer is correct.";
|
|
}
|
|
else {
|
|
wrong++;
|
|
msg = "Oops! " + Answer + " is incorrect.\n\n"
|
|
+ "The correct answer was " +numC + ".";
|
|
}
|
|
score = "" + ((correct / (correct + wrong)) * 100);
|
|
score = score.substring(0,4) + "%";
|
|
alert(msg + "\n\nYOUR SCORE: " + score + "\n"
|
|
+ correct + " correct\n"
|
|
+ wrong + " incorrect")
|
|
}
|
|
// End -->
|
|
</script>
|
|
</HEAD>
|
|
</HEAD>
|
|
|
|
<body>
|
|
<FONT face="Times New Roman,Times">
|
|
<div id="top_screen">
|
|
<img src="images/math.gif" alt="Math Quiz" width="240" height="120" border="0" hspace="4">
|
|
</div>
|
|
|
|
<div id="bottomscreen">
|
|
<form name=quizform>
|
|
<input type=button value="Add" onClick="add()">
|
|
<input type=button value="Subtract" onClick="subtract()">
|
|
<input type=button value="Multiply" onClick="multiply()">
|
|
<input type=button value="Divide" onClick="divide()">
|
|
<br>
|
|
<br>
|
|
<input type="radio" name="arithmetic">Easy
|
|
<input type="radio" name="arithmetic" checked>Moderate
|
|
<input type="radio" name="arithmetic">Difficult
|
|
|
|
<br>
|
|
<br>
|
|
<input type=button value="Check Score" onClick="check()">
|
|
<input type=button value="Reset Score" onClick="javascript:correct=0;wrong=0;">
|
|
</form>
|
|
</div>
|
|
</body>
|