Lab15
This commit is contained in:
		
							
								
								
									
										26
									
								
								Chapter ZIPs/JavaScript/ch7/ex_7_5c.html
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										26
									
								
								Chapter ZIPs/JavaScript/ch7/ex_7_5c.html
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
<html>
 | 
			
		||||
<head>
 | 
			
		||||
<title>Example 7.5</title>
 | 
			
		||||
<script>
 | 
			
		||||
function getAges()
 | 
			
		||||
{
 | 
			
		||||
	var age = 0;
 | 
			
		||||
	age = parseInt(prompt("How old is your grandmother?"));
 | 
			
		||||
	pet();
 | 
			
		||||
	function pet()
 | 
			
		||||
	{
 | 
			
		||||
		var age = parseInt(prompt("How old is your puppy?"));
 | 
			
		||||
		num = 10;
 | 
			
		||||
		document.getElementById('puppy').innerHTML = (age + num);
 | 
			
		||||
	}
 | 
			
		||||
	document.getElementById('granny').innerHTML = (age + num);
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
</head>
 | 
			
		||||
<body><table align="center" width = "70%"><tr><td><br />
 | 
			
		||||
<input type ="button" onclick="getAges()" value = "Find the age in 10 years"></button><br />
 | 
			
		||||
<h3>Your granny's age in 10 years: <span id = "granny"> </span></h3>
 | 
			
		||||
<h3>Your puppy's age in 10 years: <span id = "puppy"> </span></h3>
 | 
			
		||||
</td></tr></table>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user