Little help with my multiplication table

Right now it looks like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">


Testsida





var number;
var result;
var timesTable;

number = prompt("Which number will you calculate in your multiplication table?","");
number = parseInt(number);
timesTable = prompt("How many rows would you like to calculate?","");
for (i=1; i<=timesTable; i=i+1){
{
result = i*number
document.write ( "<tr>" + i +" x " + number+ " = " + result +"")
}
document.write ("")
document.write ("")
document.write ("")
}
if( isNaN(number) )
alert("Only type numbers, nothing else, thanks!");
if( isNaN(timesTable) )
alert("Only type numbers, nothing else, thanks!");
{
}








...and everything is as it should be, except:
I want to make a limit for the value in timestable ("How many rows would you like to calculate?") to max 12.
Anyone know how to do that? :)

Comments

  • [code]
    while(timesTable < 1 || timesTable > 12) {
    timesTable = prompt("How many rows would you like to calculate [1-12]?","");
    }
    [/code]
    ;-)
    -mac-
    mailto:mac_doggie@hotmail.com
    the Netherlands...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion