Blogger Information
Blog 27
fans 0
comment 0
visits 22524
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
循环打印乘法表-第五期0326作业
不乖的博客
Original
647 people have browsed it

实例

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script>
			/*【案例1】js打印九九乘法表
			      【案例2】计算:用*号在页面中输出一个三角形(while)
			*/
			//用for循环实现九九乘法表
			/*var i=1;
			for(i;i<=10;i++){
				document.write(i);
			}*/
			
			/*for(i=1;i<=9;i++){
				for(j=1;j<=i;j++){
					document.write(j+'*'+i+' ');
				}
				document.write("<br/>");
			}*/
			
			//用while循环实现九九乘法表
			/*var a=0;
			while(a<9){
				a++;
				var b=0;
				while(b<a){ //1 2
					b++;
					document.write(b+'*'+a+' '); //1*1
				}
				document.write('<br/>');
			}*/
			
			
			//2.用*号在页面中输出一个三角形(while)
			/*for(var h=0;h<9;h++){
				for(w=0;w<=h;w++){
					document.write('*');
				}
				document.write('<br/>');
			}*/
			
			var h=0;
			while(h<=9){
				h++;
				var w=0;
				while(w<h){
					w++;
					document.write('*');
				}
				document.write('<br/>');
			}
		</script>
	</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Correction status:Uncorrected

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post