首页 > 代码库 > JavaScript写的等边三角形(正三角形)

JavaScript写的等边三角形(正三角形)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>多次输出</title></head><body><script language="javascript">        var large = prompt("次数:");    for(var i=0;i<large;i++)        {         for(var d=0; d<large-i; d++){                  document.write("&nbsp;");               }         for(var e=0; e<=i; e++){                document.write("*"+"&nbsp;");                     }                 document.write("<br/>");                }</script></body></html>

 

JavaScript写的等边三角形(正三角形)