Blogger Information
Blog 12
fans 1
comment 0
visits 9039
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
javascript九九乘法表打印--第五期线上培训--2019-03-26
文昌的博客
Original
618 people have browsed it

实例

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>九九乘法表</title>
</head>

<body>
    <script>
        for (i = 1; i <= 9; i++) {
            for (j = 1; j <= 9; j++) {
                document.write(i + "x" + j + "=" + i * j + "   ");
                if (i == j) {
                    document.write("<br/>");
                    break;
                }
            }
        }

        //星号三角
        for (i = 0; i < 10; i++) {
            for (j = 0; j < 10 - i; j++) {
                document.write(" ");
            }
            for (n = 0; n < 1 + (i * 2); n++) {
                document.write("*");
            }
            document.write("<br>");
        }


        var i = 1;
        var j = 1;
        while (i <= 5) {
            j = 1;
            while (j <= i) {
                document.write("*");
                j++;
            }
            document.write("<br>");
            i++;
        }
    </script>
</body>

</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

111.png

Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post