九九乘法表(js_javascript)

2022-11-29 17:26:42 浏览数 (1)

文具盒正品:九九乘法表

源码:我用的【jQuery】

代码语言:javascript复制
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://code.jquery.com/jquery-3.4.0.min.js"></script>
</head>

<body>
    <h1>文具盒正品:九九乘法表</h1>
    <style>
        #tab {
            border: 1px solid black;
            border-collapse: collapse;
        }
    </style>
    <script>
        var tab = "<table border='1' id='tab'>";
        for (let i = 1; i < 10; i  ) {
            tab  = "<tr>";
            for (let j = 1; j <= i; j  ) {
                tab  = "<td>";
                tab  = j   "*"   i   "="   (i * j);
                tab  = "</td>";
            }
            tab  = "</tr>";
        }
        tab  = "</table>";
        $("body").append(tab);
    </script>
</body>

</html>

很经典的案例,希望能对大家有所帮助。

0 人点赞