<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style>
div {
height: 420px;
text-align: center;
}
img {
width: auto;
height: 100%;
}
h1 {
text-align: center;
}
</style>
</head>
<body>
<h1>当前时间</h1>
<div>
<img src="" alt="" id="im"/>
</div>
<script src="common.js"></script>
<script>
function f1() {
//获取当前时间
var dt = new Date();
//获取小时
var hour = dt.getHours();
//获取秒
var second = dt.getSeconds();
//获取分钟
var min = dt.getMinutes();
hour = hour < 10 ? "0" + hour : hour;
second = second < 10 ? "0" + second : second;
min = min < 10 ? "0" + min : min;
my$("im").src = "meimei/" + hour + "_" + min + ".jpg";
}
f1();
setInterval(f1, 1000);
</script>
</body>
</html>
点击查看效果页面