<html>
<head>
<title>Tabellina pitagorica</title>
</head>
<BODY>
<form name="tabellina">
<TABLE>
<TR>
<INPUT TYPE="Button" NAME="Tira" VALUE=" Calcola " onClick="Lancia()">
<INPUT TYPE="RESET" VALUE="CANCELLA" NAME="B2" >
<INPUT TYPE="TEXT" SIZE=10 NAME="display" value="0"><BR>
</TR>
</TABLE>
<Script language="JavaScript">
window.onload=function(){
function Lancia()
{
var i;
var j;
var c;
i=tabellina.display.value;
arr = new Array (i);
for (j = 0; j < i; ++ j)
{
arr [j] = new Array (i);
}
for (j = 0; j <= i; ++ j)
{
for (c = 0; c <= i; ++ c)
{
arr [j] [c] = (j)*(c) ;
}
}
document . writeln ("<table border>");
var row;
for (row = 0; row < arr . length; ++ row)
{
document . writeln (" <tr>");
var col;
for (col = 0; col < arr [row] . length; ++ col){
document . writeln (" <td>" + arr [row] [col] + "</td>");
document . writeln (" </tr>");}
}
document . writeln ("</table>");
document . writeln (arr [2] [2]);
}
}
</script>
</form>
</body>
</html>