Effects such as
Attachment has picture http://files.cnblogs.com/files/biyongyao/clock. rar
Source
1<! DOCTYPE html>234<meta charset= "Utf-8" >5<meta http-equiv= "x-ua-compatible" content= "ie=edge,chrome=1" >6<title>Examples</title>7<style type= "Text/css" >8 body{9 Background:black;Ten Color:white; One } A</style> -<script> - functionTonum (num)//to show the status of 01 when it is single-digit the { - if(num<10) -{return' 0 ' +num;} - Else +{return""+num;} - + } AWindow.onload=function() at { - - varObj=document.getelementsbytagname ("img"); - functionTick () - { - varTime=NewDate (); in varTime1=tonum (Time.gethours ()) +tonum (Time.getminutes ()) +tonum (Time.getseconds ());//gets a string of hour minute seconds - //Console.log (time1); to for(vari=0;i<obj.length;i++)//one has six pictures, the first two represent the hour, the middle two stands for the minute, the last two represent the second, + { -obj[i].src=time1[i]+ '. png ';//what the time string is, what picture is displayed the } * } $Window.setinterval (tick, 1000);Panax NotoginsengTick ();//in order to start not showing 000000 - the + } A</script> the + -<body> $ $ - : - the - :Wuyi the - Wu</body> -JS implementation of dynamic picture clock