Fork me on GitHub

js实现一天自动换一张图记录

js实现一天自动换一张图记录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
img {
width: 200px;
height: 100px;
}
</style>
</head>
<body>
<img id="img" />
<script type="text/javascript">
var imgSrc = new Date().getDate() +'.png';
//var imgSrc = new Date().getSeconds() +'.png'; //测试一秒换一张
document.getElementById('img').src = imgSrc;
</script>
</body>
</html>