Jquery制作一个动态的时钟
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
p{
border-radius: 550px;
width: 200px;
height: 200px;
background-color:#FFF1C2;
}
</style>
<script src="jquery.js"></script>
</head>
<body>
<center>
<h3>当前时间</h3></br></br></br></br></br></br>
<p id="show"></p>
</center>
<script>
function setTime() {
var data = new Date();
var hh = data.getHours();
mm = data.getMinutes();
ss = data.getSeconds();
data = data.getDate();
if(ss < 10){
ss = "0"+ss
}
$("#show").text(hh+":"+mm+":"+ss);
}
//设置时间间隔
setInterval(setTime, 1000);
</script>
</body>
</html>
效果图