Lab15
This commit is contained in:
		
							
								
								
									
										29
									
								
								Chapter ZIPs/JavaScript/ch7/ex_7_10.html
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										29
									
								
								Chapter ZIPs/JavaScript/ch7/ex_7_10.html
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,29 @@
 | 
			
		||||
<html>
 | 
			
		||||
<head>
 | 
			
		||||
<title>Example 7.10</title>
 | 
			
		||||
<script>
 | 
			
		||||
function getValue()
 | 
			
		||||
{
 | 
			
		||||
	var numMice = 12;
 | 
			
		||||
	document.getElementById('first').innerHTML = (numMice);
 | 
			
		||||
	numMice = changeValue(numMice); 
 | 
			
		||||
	document.getElementById('third').innerHTML = (numMice);
 | 
			
		||||
}
 | 
			
		||||
function changeValue(x)
 | 
			
		||||
{
 | 
			
		||||
    var x = 5;
 | 
			
		||||
	document.getElementById('second').innerHTML = (x);
 | 
			
		||||
	return x;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
</script>
 | 
			
		||||
</head>
 | 
			
		||||
<body><table align="center" width = "70%"><tr><td><br />
 | 
			
		||||
<input type ="button" onclick="getValue()" value = "Can you change the number? Try it"><br />
 | 
			
		||||
<h3>The value of numMice is: <span id = "first"> </span></h3>
 | 
			
		||||
<h3>The value of x, in the changeValue() function is: <span id = "second"> </span></h3>
 | 
			
		||||
<h3>The value of numMice after calling the changeValue() function is: <span id = "third"> </span></h3>
 | 
			
		||||
</td></tr></table>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user