<html> <head> <title>9*9 multiplication table</title> </head> <body> <script language="JavaScript"> var row = 9; var colum = 9; document.write("<table>"); for(i = 1; i <= row; i++){ //循环控制行 document.write("<tr>"); for (j = 1; j <= colum; j++){ //循环控制列 if (j <= i){ document.write("<td>"+ i + "*" + j + "=" + i*j + "</td>"); }else{ document.write("<td> </td>"); } } document.write("</tr>"); } document.write("</table>"); </script> </body> </html>
来源:https://www.cnblogs.com/chiangyibo/p/7002849.html