JAVAScript第一章1

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>打印倒金字塔</title>
    <style>
        hr{
            width: 50px;display: inline-block
        }
        #wang{
            margin: 0px auto;text-align: center
        }
    </style>

</head>
<body>
<div id="wang">
    <h2>打印倒金字塔直线</h2>
    <script>
        for (i=7;i>=2&&i<=7;i--) {
            for (j = i; j <=(2*i-1);j++) {
                document.write("<hr>");
            }
            document.write("<br>");
        }
        document.write("<hr>"+"<br>")
        for (i=2;i<=7;i++) {
            for (j = i; j <=(2*i-1);j++) {
                document.write("<hr>");
            }
            document.write("<br>");
        }
    </script>
</div>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/qq3144836446/article/details/81002455