当前位置:编程学习 > JAVA >>

javascript倒计时

 

<script LANGUAGE="JavaScript">

var urodz= new Date("January 1,2012");

var  s="元旦";

var now = new Date();

var ile = urodz.getTime() - now.getTime();

var dni = Math.floor(ile / (1000 * 60 * 60 * 24));

if (dni > 1)

   document.write("今天离"+s+"还有"+dni +"天")

else if (dni == 1)

     document.write("只有2天啦!")

else if (dni == 0)

     document.write("只有1天啦!")

else

    document.write("好象已经过了哦!");

</script>

 

摘自 spy1403414807的专栏

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,