Javascript Help

  • Thread starter Thread starter Rubiksmaster12
  • Start date Start date
R

Rubiksmaster12

Guest
Does anyone know what is wrong with this script?

I am trying to make a script that will create two numbers in which you must multiply them in your head, type in the text box, and it will tell you is it is correct or not.

Here is what I have;

<html>
<body>

<script type="text/javascript">

function r()

if (answer=a*b)
{
alert("Correct!");
}
else
{
alert("Inncorrect");
}
</script>

<script type="text/javascript">

a=Math.random()*999
document.write(Math.round(a) + " x ");

b=Math.random()*999
document.write(Math.round(b) + " = ");

</script>
<input type=text name="answer">
<input type="button" value="Check Answer" onclick="r()">
</body>
</html>
 
Back
Top