<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>打印倒正三角形</title> </head> <style type="text/css"> div{text-align: center;line-height: 25px;} </style> <body> <div> <script > document.write("<h2>打印倒三角</h2>") var a=prompt("请输入一个数") for(var i=a;i>0;i--){ for(var j=0;j<i;j++){ document.write("* ") } document.write("<br/>") } for(var k=1;k<=a-1;k++){ for(var h=0;h<k+1;h++){ document.write("* ") } document.write("<br/>") } </script> </div> </body> </html>
时间: 2024-11-11 04:12:00