<html>
<head>
<title> 数码时钟 author:pikaqiu </title>
<style>
body {background-image:url(images/background.jpg); font-size:100px; color:yellow; }
img{vertical-align:middle;}
</style>
<script>
function toString(num){
if(num<10){
return '0'+num;
} else {
return ""+num;
}
}
window.onload = function(){
var oDiv1 = document.getElementById('div1');
var oDiv2 = document.getElementById('div2');
var aImg1 = oDiv1.getElementsByTagName('img');
var aImg2 = oDiv2.getElementsByTagName('img');
function time(){
var oDate = new Date();
//年月日
var dateString = toString(oDate.getFullYear()) + toString(oDate.getMonth()+1) +toString(oDate.getDate());
for(var i = 0 ; i < aImg1.length ; i ++ ){
aImg1[i].src = 'images/' + dateString.charAt(i) + '.png';
}
//时分秒
var timeString = toString(oDate.getHours()) + toString(oDate.getMinutes()) + toString(oDate.getSeconds());
for(var j = 0 ; j < aImg2.length ; j ++ ){
aImg2[j].src = 'images/' + timeString.charAt(j) + '.png';
}
}
setInterval(time , 1000);
time();
}
</script>
</head>
<body>
<div id = div1>
<img src = "images/0.png" width = "75px" height = "100px" />
<img src = "images/0.png" width = "75px" height = "100px" />
<img src = "images/0.png" width = "75px" height = "100px" />
<img src = "images/0.png" width = "75px" height = "100px" />
.
<img src = "images/0.png" width = "75px" height = "100px" />
<img src = "images/0.png" width = "75px" height = "100px" />
.
<img src = "images/0.png" width = "75px" height = "100px" />
<img src = "images/0.png" width = "75px" height = "100px" />
</div><br/><br/>
<div id = div2>
<img src = "images/0.png" width = "140px" height = "200px" />
<img src = "images/0.png" width = "140px" height = "200px" />
:
<img src = "images/0.png" width = "140px" height = "200px" />
<img src = "images/0.png" width = "140px" height = "200px" />
:
<img src = "images/0.png" width = "140px" height = "200px" />
<img src = "images/0.png" width = "140px" height = "200px" />
</div>
</body>
</html>
小徐博客
- 粉丝: 1964
- 资源: 1277
最新资源
- 一个利用Java编写的,基于swing组件的连连看小游戏.zip
- 一个简易的对对碰游戏软件,运用Java、Java FX技术.zip
- 一个基于JAVA的类魔塔小游戏 a Java based MagicTowerlike game.zip
- 基于java多线程的一款小游戏.zip学习资料
- jsoniter (json-iterator) 是一款快速灵活的 JSON 解析器,可用 Java 和 Go 编写.zip
- 基于Java Swing实现的飞机大战游戏.zip
- 基于Java swing的拼图游戏,两种玩法(数字和图片).zip
- 基于java swing开发的小游戏.zip
- 动物位移小游戏Java实现,强行使用上了SQLite和MyBatis.zip
- 叠罗汉游戏,安卓java实现,自定义Framlayout,属性动画.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈