<!DOCTYPE html>
<html>
<head>
<title>timeStyle</title>
<script type="text/javascript">
window.onload=function()
{
var aImg=document.getElementsByTagName('img');
var arr;
function reTime()
{
var oDate=new Date();
function zArr(a)
{
if (a<10)
{
return '0'+a;
}
else
{
return ''+a;
}
}
arr=zArr(oDate.getHours())+zArr(oDate.getMinutes())+zArr(oDate.getSeconds());
for (var i = 0; i < aImg.length; i++) {
aImg[i].src='img/'+arr[i]+'.png'
}
}
setInterval(reTime,1000);
reTime();
}
</script>
</head>
<body style="background:#333; color:#fff; font-size:100px;">
<img src="img/0.png">
<img src="img/0.png">
:
<img src="img/0.png">
<img src="img/0.png">
:
<img src="img/0.png">
<img src="img/0.png">
</body>
</html>
网友评论