45、九九乘法表

yu
yu
2024-10-04 / 0 评论 / 5 阅读 / 正在检测是否收录...
<!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>
    <style>
        span{
            display: inline-block;
            width: 80px;
            padding: 5px 10px;
            border: 1px solid pink;
            margin: 2px;
            border-radius: 5px;
            box-shadow: 2px 2px 2px rgb(255, 192, 203);
            text-align: center;
            color: hotpink;
        }
    </style>
</head>
<body>
    <script>
        // 外层循环控制行数
        for (let i = 1; i <= 9; i++){
            // 内层循环控制列数(几个星星)
            for (let j = 1; j <= i; j++){
                document.write(`<span>${j} x ${i} = ${i * j}</span>`)
            }
            // 换行
            document.write('<br>')
        }
          
    </script>
</body>
</html>
0

评论 (0)

取消