lab17js
This commit is contained in:
		
							
								
								
									
										27
									
								
								Chapter ZIPs/JavaScript/ch8/ex_8_16.html
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										27
									
								
								Chapter ZIPs/JavaScript/ch8/ex_8_16.html
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
<html>
 | 
			
		||||
<head>
 | 
			
		||||
<title>Example 8.16</title>
 | 
			
		||||
<script type="text/javascript">
 | 
			
		||||
var myarray = new Array(6); //allocates 6 rows to the array
 | 
			
		||||
for (i = 0; i < 6; i++)
 | 
			
		||||
		{
 | 
			
		||||
			myarray[i] = new Array(5); //allocates 5 columns each row
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
document.write("Ex 8.16: 2-D array: <br />");
 | 
			
		||||
	for (var i = 0; i < 6; i++)
 | 
			
		||||
	{
 | 
			
		||||
	 	for (var j = 0; j < 5; j++)
 | 
			
		||||
		{
 | 
			
		||||
			myarray[i][j] = prompt("Enter value for row " + i + ", column " + j +":");	
 | 
			
		||||
			document.write(myarray[i][j] + " ");		
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		document.write("<br />");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	</script>
 | 
			
		||||
	</head>
 | 
			
		||||
	<body>
 | 
			
		||||
	</body>
 | 
			
		||||
	</html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user