亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

JS實(shí)現(xiàn)圖片數(shù)字時(shí)鐘

 更新時(shí)間:2021年10月04日 09:23:03   作者:是福不是禍  
這篇文章主要為大家詳細(xì)介紹了JS實(shí)現(xiàn)圖片數(shù)字時(shí)鐘,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了JS實(shí)現(xiàn)圖片數(shù)字時(shí)鐘的具體代碼,供大家參考,具體內(nèi)容如下

首先這是我們準(zhǔn)備的圖片

<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>Document</title>
 <style>
  
 </style>
</head>
<body>
 <div>
  <img src="img/0.png" alt="">
  <img src="img/0.png" alt="">
  <img src="img/10.png" alt="">
  <img src="img/0.png" alt="">
  <img src="img/0.png" alt="">
  <img src="img/10.png" alt="">
  <img src="img/0.png" alt="">
  <img src="img/0.png" alt="">
 
 </div>
 
 <script type="text/javascript">
    //函數(shù)
    function get(){
      //獲取頁(yè)面img
      var img=document.getElementsByTagName('img');
      //獲取時(shí)間    
      var date=new Date();
      var hour=date.getHours();
      var minute=date.getMinutes();
      var secind=date.getSeconds();
      //補(bǔ)0
      if(hour<10){
       hour='0'+hour;
      }else if(minute<0){
       minute='0'+minute;
      }else if (secind) {
       secind='0'+secind;
      }
    //字符串拼接
    img[0].src='img/'+parseInt(hour/10)+'.png';
    img[1].src='img/'+hour%10+'.png';
    img[3].src='img/'+parseInt(minute/10)+'.png';
    img[4].src='img/'+minute%10+'.png';
    img[6].src='img/'+parseInt(secind/10)+'.png';
    img[7].src='img/'+secind%10+'.png';
 
    }
    get(); 
    setInterval(get,1000);
//調(diào)用沒(méi)個(gè)一秒刷新一次
 
   </script>
</body>
</html>

最后實(shí)現(xiàn)

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論