JavaScript中将九九乘法口诀在9乘9表格中输出

时间:2021-12-24 23:50:48
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <script>
        document.write("<table border='1'>");
        for(var x = 1; x<=9;x++){
            document.write("<tr>")
            for(var y = 1; y<=x; y++){
                document.write("<td>"+x+"*"+y+"="+x*y+"</td>");
            }
            for(var m= 1; m <=9-x; m++ ){
                document.write("<td> </td>");
            }
            document.write("</tr>");
        }

        document.write("</table >");
    </script>
    <title></title>
</head>
<body>

</body>
</html>