首页 > 网站 > WEB开发 > 正文

js打出各种*样式的三角形

2024-04-27 15:15:43
字体:
来源:转载
供稿:网友
<!DOCTYPE html><html>	<head>		<meta charset="UTF-8">		<title></title>		<script type="text/javascript">			for (var row = 1; row <= 6; row++) {				for (var geshu = 1; geshu <= 6-row; geshu++) {						document.write(" ");				}								for (var col = 1; col <= row; col++) {					document.write("*");				}				document.write("<br />");			}			document.write("<hr />");						for (var row = 1; row <= 6; row++) {				for (var geshu = 1; geshu <= 6-row; geshu++) {						document.write(" ");				}								for (var col = 1; col <= row; col++) {					document.write("*");				}				document.write("<br />");			}			document.write("<hr />");			document.write("<hr />");						for (var row = 1; row <= 5; row++) {				for (var geshu = 1; geshu <= 5-row; geshu++) {						document.write(" ");				}								for (var col = 1; col <= row*2-1; col++) {					document.write("*");				}				document.write("<br />");			}			document.write("<hr />");			document.write("<hr />");			for (var row = 1; row <= 5; row++) {				for (var geshu = 1; geshu <= (5-row); geshu++) {						document.write(" ");//						document.write("");				}								for (var col = 1; col <= row*2-1; col++) {					document.write("*");				}				document.write("<br />");			}			for (var row = 1; row <= 4; row++) {				for (var geshu = 1; geshu <= row; geshu++) {						document.write(" ");				}				for (var col = 1; col <= (4-row)*2+1; col++) {					document.write("*");				}				document.write("<br />");			}		</script>	</head>	<body>		<hr />		<hr />		<div style="text-indent:0.5em">			<script type="text/Javascript">			for (var row = 1; row <= 5; row++) {				for (var geshu = 1; geshu <= (5-row); geshu++) {//						document.write(" ");						document.write(geshu);				}								for (var col = 1; col <= row*2-1; col++) {					document.write("*");				}				document.write("<br />");			}			for (var row = 1; row <= 4; row++) {				for (var geshu = 1; geshu <= row; geshu++) {						document.write(" ");				}				for (var col = 1; col <= (4-row)*2+1; col++) {					document.write("*");				}				document.write("<br />");			}		</script>		</div>	</body></html>
上一篇:thinkphp页面重定向

下一篇:浮动总结

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表