用jquery製做一個動態時鐘

GIF動態圖:html

 

 

 

 

代碼:jquery

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script src="js/jquery-3.3.1.js"></script>
</head>

<body>
<div id="div11"></div>
</body>
<script>
    $(function(){
		setInterval(
		            function(){
		                var date = new Date();
		                var s = date.getSeconds();
		                var m = date.getMinutes();
		                var h = date.getHours();
		                $("#div11").text(h+":"+m+":"+s);
		            },
					
		    1000);
		
		
		
		});
		</script>
</html>
相關文章
相關標籤/搜索