Multiplication Table Generator by using for loop : For Loop : Statement JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Statement » For Loop »

 

Multiplication Table Generator by using for loop

















<html>
<head>
<title>Multiplication Table Generator</title>

<script language="javascript" type="text/javascript">
<!--

function generateTable()
{
     var myVar = prompt("A number?""");
     var myString = "";
     for (i=1; i<=6; i++) {
       myString += i+ " x " +myVar+ " = " +(i*myVar)"n";
     }
     alert(myString);
}

//-->
</script>

</head>
<body>

<a href="javascript:generateTable()">Create New Table</a>

</body>
</html>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Statement
» For Loop