日期:2014-05-16  浏览次数:20326 次

js时钟显示
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>时钟 TIME</title>
	<script type=text/javascript>
			function startTime(){
				var today = new Date();
				var h = today.getHours();
				var m = today.getMinutes();
				var s = today.getSeconds();
				h=check(h);
				m=check(m);
				s=check(s);
				document.getElementById("show").innerHTML=h+"<font size='20'>:</font>"+m+"<font size='20'>:</font>"+s;
				t=setTimeout('startTime()',500);
			}
			function check(n){
				if(n<10){
					n = "0"+n;
				}
				return "<font size=20 color='red'>"+n+"</font>";
			}
	</script>
</head>
<body onLoad="startTime()">
	<br/><br/>
	<div align = "center" id = "show">		
	</div>
</body>
</html>