<button onclick="Calc()">Start</button><br />
<input id="O1" size="1" value="" />x<input id="O2" size="1" value="" />=<input id="I" size="1" /><br />
<button onclick="Check()">Check</button><br />
<input id="Output3" size="3" value="" />
<script type="text/javascript">
function Calc()
{var a,b,c;
a=Math.floor(Math.random()*9)+1;
b=Math.floor(Math.random()*9)+1;
document.getElementById("O1").value=a;
document.getElementById("O2").value=b;
}
function Check()
{var x,y,z;
x=Number(document.getElementById("O1").value);
y=Number(document.getElementById("O2").value);
z=Number(document.getElementById("I").value);
if(x*y==z)document.getElementById("Output3").value="Correct";
else document.getElementById("Output3").value="Wrong";
}
</script>
<br />
<input id="O1" size="1" value="" />x<input id="O2" size="1" value="" />=<input id="I" size="1" /><br />
<button onclick="Check()">Check</button><br />
<input id="Output3" size="3" value="" />
<script type="text/javascript">
function Calc()
{var a,b,c;
a=Math.floor(Math.random()*9)+1;
b=Math.floor(Math.random()*9)+1;
document.getElementById("O1").value=a;
document.getElementById("O2").value=b;
}
function Check()
{var x,y,z;
x=Number(document.getElementById("O1").value);
y=Number(document.getElementById("O2").value);
z=Number(document.getElementById("I").value);
if(x*y==z)document.getElementById("Output3").value="Correct";
else document.getElementById("Output3").value="Wrong";
}
</script>
<br />
No comments:
Post a Comment