Make your own free website on Tripod.com
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  
  <HEAD>
    <TITLE>
      Test Your Multiplication Power!
    </TITLE>
    <META name="GENERATOR" content="Arachnophilia 4.0">
    <META name="FORMATTER" content="Arachnophilia 4.0">
    
<SCRIPT LANGUAGE = "JavaScript">

function question()
{
  var num1, num2;
  num1 = Math.floor( 1 + Math.random() * 9 );
  num2 = Math.floor( 1 + Math.random() * 9 );
  document.forms["multiply"].Q.value = "How much is "+num1+" times "+num2+"?";
  document.forms["multiply"].answer.value =  num1 * num2 ;
  document.forms["multiply"].guess.value = "";
  document.forms["multiply"].guess.focus();
}

function checkAns()
{
  if (document.forms["multiply"].answer.value == document.forms["multiply"].guess.value) {
    window.status="Very good!";
    question();
  }
  else {
    window.status="No.  Please try again.";
    document.forms["multiply"].guess.select();
    document.forms["multiply"].guess.focus();
  }
}

</SCRIPT>
    
  </HEAD>
  <BODY ONLOAD="question()">
    Exercise 11.29
    <P>
    
    
    <CENTER>
      <H2>
        Test Your Multiplication Power!
      </H2>
    </CENTER>
    <FORM NAME = "multiply">
      <INPUT type="hidden" name="answer" value=0>
      <TABLE BORDER = "0" align="center">
        <TR>
          <TD>
            <INPUT type="text" name="Q" size="30"  value="default value">
          </TD>
        </TR>
        <TR>
          <TD>
            Enter answer here: 
            <INPUT TYPE = "text" NAME = "guess" size="4" maxlength="3" value="0">
             
            <INPUT type="button" value="Am I right?" onclick="checkAns()">
          </TD>
        </TR>
        <TR>
        </TR>
        <TR>
          <TD align=center>
            <FONT size="-1">
              <I>
                See answer in status bar below
              </I>
            </FONT>
          </TD>
        </TR>
      </TABLE>
    </FORM>
  </BODY>
</HTML>