Just to share ideas, here's a copy of the math problem page I wrote. I didn't comment it very well, but it should be fairly easy to vary the range of numbers used.
<html>
<head>
<title>Math Work</title>
<script language="javascript">
// this part gets the previous score, if there was one
var pagename=location.href, results, right=0, wrong=0, notdone=0;
if (location.href.indexOf('?') > -1)
{
pagename=location.href.substr(0,location.href.indexOf('?'));
results=location.href.substr(location.href.indexOf('?')+1);
right=results.substring(results.indexOf('right=') + 6, results.indexOf('&'));
results=results.substr(results.indexOf('&') + 1);
wrong=results.substring(results.indexOf('wrong=') + 6, results.indexOf('&'));
results=results.substr(results.indexOf('&') + 1);
notdone=results.substring(results.indexOf('notdone=') + 8);
}
var total=(right * 1) + (wrong * 1) + (notdone * 1);
var NumberOfProblems=10;
var MaximumNumber=10000;
//this just randomly picks either subtraction, addition, or multiplication
var sign=Math.floor(Math.random() * 12);
switch (sign % 4)
{
case 0: sign='+'; break;
case 1: sign='-'; break;
case 2:
case 3:
{
sign='*';
MaximumNumber=12;
break;
}
}
MaximumNumber++;
var answercount=0;
var number1=Math.floor(Math.random() * MaximumNumber);
var number2=Math.floor(Math.random() * MaximumNumber);
//this makes sure the answer isn't a negative number
if (sign=='-' || sign=='*')
{
while (number2 > number1) number2=Math.floor(Math.random() * MaximumNumber);
}
function checkanswer()
{
var correct= eval('document.math.result.value==(number1' + sign + 'number2)');
if (document.math.result.value=='') correct=false;
if (correct)
{
alert('Very good');
right++;
nextpage();
}
else
{
answercount++;
//if they get the answer wrong more than twice, try another problem
if (answercount>2)
{
alert('Let\'s try another problem');
wrong++;
nextpage();
}
else
{
alert('Sorry, try again');
document.math.result.value='';
document.math.result.focus();
}
}
}
function nextpage()
{
location.href=pagename + '?right=' + right + '&wrong=' + wrong + '¬done=' + notdone;
}
</script>
</head>
<body onload="document.math.result.focus()">
<center><font size=6><b>Math Work</b></font><br><br>
<form name=math onsubmit="checkanswer(); return false;">
<table cellspacing=0 cellpadding=0 border=0>
<tr>
<td align=center><table><tr><td align=right><font size=5>
<script language="javascript">
//if there have been less than the maximum number of problems, do another problem
if (total < NumberOfProblems)
{
var mathstring=number1 + '<br>';
if (sign=='*') mathstring += 'x';
else mathstring += sign;
mathstring += ' ' + number2 + '<hr width=';
if (sign=='*') mathstring += '45';
else mathstring += '85';
mathstring += '><input type=text name=result size=';
if (sign=='*') mathstring += '3';
else mathstring += '6';
mathstring += ' value="">';
document.write(mathstring);
}
//otherwise give the score of right answers, wrong answers, and problems skipped
else
{
document.write('You had ' + right + ' correct answer');
if (right!=1) document.write('s');
document.write('<br>You had ' + wrong + ' incorrect answer');
if (wrong!=1) document.write('s');
document.write('<br>You skipped ' + notdone + ' problem');
if (notdone!=1) document.write('s');
}
document.write('</td></tr></table></td></tr><tr><td align=center><br>')
if (total < NumberOfProblems)
{
document.write('<input type=button name=calculate ');
document.write('value=" Calculate " ');
document.write('onclick="checkanswer(); return true;"><br><br>');
document.write('<input type=button name=next value=" Next Problem " ');
document.write('onclick="notdone++; nextpage(); return true;">');
}
else
{
document.write('<input type=button name=result ');
document.write('value=" Try Again " ');
document.write('onclick="location.href=pagename; return true;">');
}
</script>
</td>
</tr>
</table>
</form>
</body>
</html>