<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>金字塔</title>
        <style type="text/css">
            body{
                font-size: 30px;
            }
            
            .empty{
                display: inline-block;
                width: 40px;
                height: 20px;
                line-height: 20px;
                visibility: hidden;
            }
            
            .cont{
                display: inline-block;
                width: 40px;
                height: 20px;
                line-height: 20px;
                color: black;
            }
        </style>
    </head>
    <body>
        
        <script type="text/javascript" src="js/jinzita.js" ></script>
    </body>
</html>
for(var i=0; i<=10; i++){
    
    for(var j=10; j>=i; j--){
        document.write('<span class="empty">▲</span>');
    }
    
    for(var k=0; k<=i*2; k++){
        document.write('<span class="cont">▲</span>');
    }
    
    document.write('<br />');
}

JavaScript金字塔打印

相关文章:

  • 2021-04-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2018-12-03
猜你喜欢
  • 2022-12-23
  • 2021-04-20
  • 2021-10-12
  • 2021-03-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案