Lab15
This commit is contained in:
		
							
								
								
									
										28
									
								
								Chapter ZIPs/JavaScript/ch7/ex_7_14.html
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										28
									
								
								Chapter ZIPs/JavaScript/ch7/ex_7_14.html
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
<html>
 | 
			
		||||
<head>
 | 
			
		||||
<title>Example 7.14</title>
 | 
			
		||||
<script>
 | 
			
		||||
function startClock()
 | 
			
		||||
{
 | 
			
		||||
	var today = new Date();
 | 
			
		||||
	var hour = today.getHours(); var min = today.getMinutes(); var sec = today.getSeconds();
 | 
			
		||||
	min = checkTime(min);
 | 
			
		||||
	sec = checkTime(sec);
 | 
			
		||||
	document.getElementById('now').innerHTML = ("Today's date: " + today);
 | 
			
		||||
	document.getElementById('clock').innerHTML = hour + ":" + min + ":" + sec;
 | 
			
		||||
	timer = setTimeout('startClock()',500);
 | 
			
		||||
}
 | 
			
		||||
function checkTime(i)
 | 
			
		||||
{
 | 
			
		||||
	if (i<10)
 | 
			
		||||
		i="0" + i;
 | 
			
		||||
	return i;
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
</head>
 | 
			
		||||
<body><table align="center" width = "70%"><tr><td><br />
 | 
			
		||||
<input type ="button" onclick="startClock()" value = "Does anyone know what day it is?"><br />
 | 
			
		||||
<h3><span id = "now"> </span></h3>
 | 
			
		||||
<h3><span id = "clock"> </span></h3>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user