<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>四年级数学强化练习器</title>
<style></style>
<script type="text/javascript"></script>
</head>
<body>
<h1>四年级数学强化练习器</h1>
<div>
<input id="createbtn" type="button" value="创建试题1" title="每次创建加减乘除和四则混合运算各2题!"
onclick="createQuest()"/>
<label style="margin-left: 100px;font-size: 20px;color: #06a8f3;">
测试时间:<input id="testtime" type="text" value="" disabled="disabled"
style="width: 120px;margin-right: 10px;color: #ff0000;"/>秒
</label>
<label id="score"
style="margin-left: 100px;font-size: 20px;color: #ff0000;">测试成绩:____________分</label>
</div>
<table>
<thead>
<tr>
<th style="width: 100px">序号</th>
<th style="width: 400px">试题内容</th>
<th style="width: 100px">试题正误</th>
<th style="width: 100px">序号</th>
<th style="width: 400px">试题内容</th>
<th style="width: 100px">试题正误</th>
</tr>
</thead>
<tbody id="quest">
<tr>
<th>1</th>
<td></td>
<td></td>
<th>2</th>
<td></td>
<td></td>
</tr>
<tr>
<th>3</th>
<td></td>
<td></td>
<th>4</th>
<td></td>
<td></td>
</tr>
<tr>
<th>5</th>
<td></td>
<td></td>
<th>6</th>
<td></td>
<td></td>
</tr>
<tr>
<th>7</th>
<td></td>
<td></td>
<th>8</th>
<td></td>
<td></td>
</tr>
<tr>
<th>9</th>
<td></td>
<td></td>
<th>10</th>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>
<input id="finishbtn" type="button" value="提交试题" disabled="disabled" title="请先创建试题!"
onclick="finishQuest()"/>
<input id="revisebtn" type="button" value="试题订正" disabled="disabled" title="订正完成后请重新提交试题!"
style="margin-left: 100px;"
onclick="reviseQuest()"/>
</p>
<p>
<label>备注:每次创建加减乘除和四则混合运算各2题,共计10题,测试时间
<script>document.write(testtime); </script>
分钟;加减每题5分,乘除每题10分,四则混合运算每题20分,共计100分。</label>
</p>
</body>
</html>
<style>
* {
font-size: 11pt;
border: 0;
margin: 0;
padding: 0;
}
body {
font-family: "Microsoft YaHei", 微软雅黑, SimSun, 宋体, Arial, Helvetica, "sans-serif";
margin: 10px auto;
width: 1200px;
padding: 20px;
}
h1 {
font-family: "Microsoft YaHei", 微软雅黑, SimSun, 宋体, Arial;
clear: both;
font-weight: normal;
font-size: 36px;
color: #000000;
height: 50px;
width: 100%;
line-height: 40px;
text-align: center;
border: 0px solid #0ff;
margin-top: 10px;
margin-bottom: 10px;
}
table {
width: 1200px;
border: 0;
clear: both;
text-align: center;
border-collapse: collapse;
}
table th {
height: 44px;
line-height: 28px;
border: solid 1px #000000;
text-indent: 0px;
text-align: center;
font-weight: normal;
font-size: 20px;
}
table td {
height: 44px;
line-height: 28px;
border: solid 1px #000000;
text-indent: 0px;
text-align: left;
font-weight: normal;
padding-left: 10px;
padding-right: 10px;
font-size: 20px;
}
input[type=button] {
width: 160px;
height: 44px;
font-size: 20px;
font-weight: normal;
background-color: #cee0f5;
color: #000000;
cursor: pointer;
line-height: 35px;
margin-top: 20px;
margin-bottom: 20px;
}
input[type=button]:hover {
color: #ff0000;
text-decoration: none;
}
input[type=text] {
width: 80px;
height: 30px;
border: solid 1px #9ecee4;
font-size: 20px;
text-align: center;
cursor: pointer;
line-height: 30px;
}
input[type=text]:focus {
border: solid 0px #9ecee4;
text-decoration: none;
}
</style>
<script type="text/javascript">
var testtime = 15;
let timerflag, limit;
//测试倒计时函数
function testTimer() {
document.getElementById('testtime').value = timeToStr(limit, 1);
limit--;
timerflag = setTimeout('testTimer()', 1000);
if (limit < 0) {
finishQuest();
}
}
//时间转换函数
function timeToStr(t, flag) {
let curhr = Math.floor(t / 3600);
let curmin = Math.floor((t / 60) % 60);
let cursec = Math.floor(t % 60);
if (flag == 1) {
return numToStr(curhr) + ' : ' + numToStr(curmin) + ' : ' + numToStr(cursec);
} else {
return numToStr(curmin) + ' 分 ' + numToStr(cursec) + ' 秒 ';
}
}
//个位数前面补0函数
function numToStr(num) {
return num < 10 ? '0' + num : num;
}
//生成从minNum到maxNum的随机数
function randomNum(minNum, maxNum) {
switch (arguments.length) {
case 1:
return parseInt(Math.random() * minNum + 1, 10);
break;
case 2:
return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
break;
default:
return 0;
break;
}
}
let mixarr = ["", "672-672÷12×7", "987÷(345-298)×65", "210×[520÷(240-227)]", "340-240÷20×5",
"30×(320-170)÷90", "[458-(85+28)]÷23", "630×[840÷(240-212)]", "408÷[512-(178+283)]",
"864÷[(27-23)×12]", "(105×12-635)÷25", "240-140÷5×3", "360-260÷20×5",
"104×48+272÷16", "35+65÷5-20", "240+180÷30×2", "450÷30+20×3",
"146-(34+420÷70)", "624÷[(27-14)×4]", "(77-21÷7)×691", "(165-65÷5)×5",
"840÷[(120+195)÷15]", "[557-(186+26)]÷23", "375÷(25-10)×15", "(659-34)+(280÷40)",
"15×27-200÷8", "(324-285)×12÷26", "(160-48÷12)×4", "336÷[(36-29)×6]",
"62×(300-145÷5)", "35×(320-170)÷50", "(36×54-984)÷24", "150÷[90÷(67-52)]",
"182÷[36÷(12+6)]", "640÷[(96-80)×4]", "57×12-560÷35", "848-640÷16×12",
"2800÷100+789", "(947-599)+76×64", "36×(913-276÷23)", "(93+25×21)×9",
"507÷13×63+498", "723-(521+504)÷25", "384÷12+23×371", "(39-21)×(396÷6)",
"156×[(17.7-5.7)÷3]", "[37.85-(7.65+6.2)]×30", "28×(5+954÷318)", "720÷[(62-54)×9]",
"960÷(1500-32×45)", "[192-(54+38)]×67", "(13×125)×(3×8)", "83×102-83×2",
"(12+24+80)×50", "32×(25+125)", "178×101-178", "84×36+64×84",
"75×99+2×75", "5×123+85×123", "50×(34×4)×3", "25×(24+16)",
"178×99+178", "79×42+79+79×57", "75×27+19×25", "31×870+13×310",
"4×(25×65+25×28)", "280+840÷24×5", "85×(95-1440÷24)", "6670÷(105+20×2)",
"8040-(4300+870÷15)", "1437×27+27×563", "81432÷(13×52+78) ", "125×(33-1)",
"37.4-(8.6+7.4-6.6)", "156×107-7729", "37.85-(7.85+6.4)", "287×5+96990÷318",
"1554÷[(72-58)×3]", "360÷[(12+6)×5]", "288÷[(26-14)×8]", "500×6-(50×2-80)",
"(105×12-635)÷25", "96÷[(27-23)×12]", "(45+38-16)×24", "500-(240+38×6)",
"[64-(87-42)]×15", "(845-15×3)÷16", "12×[(49-28)÷7]", "450÷[(84-48)÷12]",
"(58+37)÷(64-9×5)", "178-145÷5×6+42", "49×102-2×49", "125×78×8",
"8.33-2.43-4.57", "6.7-2.63+3.3-3.37", "41000÷(41×5)", "3.5×72+6.5×28",
"5824÷8×(85-78)", "840÷28+70×18", "6.45-0.33-1.12", "3.27+6.4+2.73+4.6",
"125×32×25", "12000÷125×25×44", "(160+880)×20", "12×(324-285)÷26",
"99×64+64", "715+265+335+285", "125×32×5", "46×2017+54×2017",
"100-137-263+300", "75×4×2×5", "34+346+66", "74+(167+26)",
"37-56+73-44", "55×22+78×55", "203×46-3×46", "49×99+99",
"98×101-98", "49×99+49", "45+45×26+45×73", "38×36-36×8",
"874÷(24×23-506)", "6×(15×9)", "25×5÷(155-30)", "25×(696+456)÷16",
"48×(39-594÷33)", "(40+4)×25", "43+57-43+57", "24×5-24×5",
"24×5÷24×5", "96×101-96", "486-(186+59)-41", "43+78+122+257",
"25×(26×4)", "354+(229+46)", "26×39+61×26", "356×9-56×9",
"78×101-78", "52×76+47×76+76", "134×56-134+45×134", "456-(256-36)",
"48×52×2-4×48", "25×23×(40+4)", "999×999+1999", "(569+468)+(432+131)",
"189-(89+74)", "28×4×25", "125×64×25", "9×72×125",
"720÷16÷5", "99×55+55", "158+262+138", "(375+1034)+(966+125)",
"375+219+381+225", "5001-247-1021-232", "(181+2564)+2719", "7755-(2187+755)",
"378+44+114+242+222", "276+228+353+219", "(2130+783+270)+1017", "99+999+9999+99999",
"2214+638+286", "3065-738-1065", "899+344+101", "497-299-197",
"2357-183-317-357", "2365-1086-214", "7755-(2187+755)", "3999+498-97",
"1883-398+98", "138×25×4", "(13×125)×(3×8)", "(12+24+80)×50",
"25×32×125", "32×(25+125)", "88×125+44×25", "102×76-2×76",
"178×101-178", "84×36+64×84", "75×99+2×75", "123×18-123×3+85×123",
"98×199", "50×(34×4)×3", "25×(24+16)", "7300÷25÷4",
"178×99+178", "79×42+79+79×57", "8100÷4÷75", "158+262+138",
"1248÷24", "3150÷15", "4800÷25", "31500÷2100",
"21500÷125", "16800÷120", "375+219+381+225", "378+44+114+242+222",
"32000÷400", "49700÷700", "5001-247-921-332", "(272+2654)+2728"];
let mixkey = [0, 280, 1365, 8400, 280, 50, 15, 18900, 8, 18, 25, 156, 295, 5009, 28, 252, 75,
106, 12, 51134, 760, 40, 15, 375, 632, 380, 18, 624, 8, 16802, 105, 40, 25,
91, 10, 668, 368, 817, 5212, 32436, 5562, 2955, 682, 8565, 1188, 624, 720, 224, 10,
16, 6700, 39000, 8300, 5800, 4800, 17800, 8400, 7575, 11070, 20400, 1000, 17800, 7900, 2500, 31000,
9300, 455, 2975, 46, 3682, 54000, 108, 4000, 28, 8963, 23.6, 1740, 37, 4, 3, 2980,
25, 2, 1608, 32, 285, 50, 36, 150, 5, 46, 4900, 78000, 1.33, 4, 200, 434,
5096, 1434, 5, 17, 100000, 105600, 20800, 18, 6400, 1600, 20000, 201700, 0, 3000, 446, 267,
10, 5500, 9200, 5000, 9800, 4900, 4500, 1080, 19, 810, 5, 1800, 1008, 1100, 114, 0,
25, 9600, 200, 500, 2600, 629, 2600, 2700, 7800, 7600, 13400, 164, 4800, 25300, 1000000, 1600,
26, 2800, 200000, 81000, 9, 5500, 558, 2500, 1200, 3501, 5464, 4813, 1000, 1076, 4100, 111096,
3138, 1262, 1344, 1, 1500, 1065, 4813, 4400, 1583, 13800, 39000, 5800, 100000, 4800, 12100, 7600,
17800, 8400, 7575, 12300, 19502, 20400, 1000, 73, 17800, 7900, 27, 558, 52, 210, 192, 15,
172, 140, 1200, 1000, 80, 71, 3501, 5654];
let num = 1,testflag = 0;
let key = new Array();
//生成试题函数
function createQuest() {
let st, a, b, x, y, mixLength = mixarr.length;
limit = testtime * 60;
testflag = 0;
a = randomNum(100, 1000);
b = randomNum(100, 1000);
st = '<tr><th>1</th><td>' + a + ' + ' + b + ' = <input id="q1" type="text" value=""/></td><th id="k1"></th>';
key[1] = a + b;
a = randomNum(100, 5000);
b = randomNum(100, 1000);
st += '<th>2</th><td>' + a + ' + ' + b + ' = <input id="q2" type="text" value=""/></td><th id="k2"></th></tr>';
key[2] = a + b;
x = randomNum(100, 1000);
y = randomNum(100, 1000);
a = x > y ? x : y;
b = x > y ? y : x;
st += '<tr><th>3</th><td>' + a + ' - ' + b + ' = <input id="q3" type="text" value=""/></td><th id="k3"></th>';
key[3] = a - b;
x = randomNum(100, 5000);
y = randomNum(100, 3000);
a = x > y ? x : y;
b = x > y ? y : x;
st += '<th>4</th><td>' + a + ' - ' + b + ' = <input id="q4" type="text" value=""/></td><th id="k4"></th></tr>';
key[4] = a - b;
a = randomNum(100, 1000);
b = randomNum(10, 100);
st += '<tr><th>5</th><td>' + a + ' × ' + b + ' = <input id="q5" type="text" value=""/></td><th id="k5"></th>';
key[5] = a * b;
a = randomNum(100, 500);
b = randomNum(100, 500);
st += '<th>6</th><td>' + a + ' × ' + b + ' = <input id="q6" type="text" value=""/></td><th id="k6"></th></tr>';
key[6] = a * b;
x = randomNum(100, 1000);
y = randomNum(10, 100);
a = x > y ? x : y;
b = x > y ? y : x;
st += '<tr><th>7</th><td>' + a + ' ÷ ' + b + ' = <input id="q7" type="text" value=""/> ... <input id="q11" type="text" value=""/></td><th id="k7"></th>';
key[7] = parseInt(a / b);
key[11] = a % b;
x = randomNum(100, 2000);
y = randomNum(10, 100);
a = x > y ? x : y;
b = x > y ? y : x;
st += '<th>8</th><td>' + a + ' ÷ ' + b + ' = <input id="q8" type="text" value=""/> ... <input id="q12" type="text" value=""/></td><th id="k8"></th></tr>';
key[8] = parseInt(a / b);
key[12] = a % b;
a = randomNum(mixLength - 1);
b = mixarr[a];
st += '<tr><th>9</th><td>' + b + ' = <input id="q9" type="text" value=""/></td><th id="k9"></th>';
key[9] = mixkey[a];
a = randomNum(mixLength - 1);
b = mixarr[a];
st += '<th>10</th><td>' + b + ' = <input id="q10" type="text" value=""/></td><th id="k10"></th></tr>';
key[10] = mixkey[a];
document.getElementById('quest').innerHTML = st;
document.getElementById('finishbtn').value = '提交试题' + num;
document.getElementById('finishbtn').disabled = '';
num++;
document.getElementById('createbtn').value = '创建试题' + num;
clearTimeout(timerflag);
testTimer();
}
//提交试题函数
function finishQuest() {
let score = 0;
let rightstr = '<label style="color: green;font-size: 30px;font-family:宋体;">√</label>';
let errorstr = '<label style="color: red;font-size: 30px;font-family:宋体;">×</label>';
if (document.getElementById('q1').value * 1 == key[1] * 1) {
score += 5;
document.getElementById('k1').innerHTML = rightstr;
} else {
document.getElementById('k1').innerHTML = errorstr;
}
if (document.getElementById('q2').value * 1 == key[2] * 1) {
score += 5;
document.getElementById('k2').innerHTML = rightstr;
} else {
document.getElementById('k2').innerHTML = errorstr;
}
if (document.getElementById('q3').value * 1 == key[3] * 1) {
score += 5;
document.getElementById('k3').innerHTML = rightstr;
} else {
document.getElementById('k3').innerHTML = errorstr;
}
if (document.getElementById('q4').value * 1 == key[4] * 1) {
score += 5;
document.getElementById('k4').innerHTML = rightstr;
} else {
document.getElementById('k4').innerHTML = errorstr;
}
if (document.getElementById('q5').value * 1 == key[5] * 1) {
score += 10;
document.getElementById('k5').innerHTML = rightstr;
} else {
document.getElementById('k5').innerHTML = errorstr;
}
if (document.getElementById('q6').value * 1 == key[6] * 1) {
score += 10;
document.getElementById('k6').innerHTML = rightstr;
} else {
document.getElementById('k6').innerHTML = errorstr;
}
if (document.getElementById('q7').value * 1 == key[7] * 1
&& document.getElementById("q11").value * 1 == key[11] * 1) {
score += 10;
document.getElementById('k7').innerHTML = rightstr;
} else {
document.getElementById('k7').innerHTML = errorstr;
}
if (document.getElementById('q8').value * 1 == key[8] * 1
&& document.getElementById("q12").value * 1 == key[12] * 1) {
score += 10;
document.getElementById('k8').innerHTML = rightstr;
} else {
document.getElementById('k8').innerHTML = errorstr;
}
if (document.getElementById('q9').value * 1 == key[9] * 1) {
score += 20;
document.getElementById('k9').innerHTML = rightstr;
} else {
document.getElementById('k9').innerHTML = errorstr;
}
if (document.getElementById('q10').value * 1 == key[10] * 1) {
score += 20;
document.getElementById('k10').innerHTML = rightstr;
} else {
document.getElementById('k10').innerHTML = errorstr;
}
if(testflag == 0){
document.getElementById('score').innerHTML = '试题 ' + (num - 1) + ' 测试成绩:' + score
+ ' 分,测试用时:' + timeToStr(testtime * 60 - limit - 1, 0);
}else{
document.getElementById('score').innerHTML = '试题 ' + (num - 1) + ' 订正后成绩:' + score
+ ' 分,测试订正合计用时:' + timeToStr(testtime * 60 - limit - 1, 0);
}
for (let i = 1; i < 13; i++) {
document.getElementById('q' + i).readOnly = true;
document.getElementById('q' + i).style.border = "solid 1px #9ecee4";
}
document.getElementById('finishbtn').disabled = 'disabled';
clearTimeout(timerflag);
if (score * 1 < 100) {
document.getElementById('revisebtn').disabled = '';
document.getElementById('revisebtn').value = '订正试题' + (num - 1);
}
}
//订正试题函数
function reviseQuest() {
testflag = 1;
for (let i = 1; i < 13; i++) {
if (document.getElementById('q' + i).value * 1 != key[i] * 1) {
document.getElementById('q' + i).readOnly = false;
document.getElementById('q' + i).style.border = "solid 1px #ff0000";
}
}
document.getElementById('finishbtn').disabled = '';
testTimer();
}
//测试函数
function createQ() {
document.getElementById('quest').innerHTML = Math.random();//randomNum(mixLength);
}
</script>
四年级数学强化练习器