Home  >  Article  >  Web Front-end  >  2012 doomsday countdown code turns out to be nothing but a false alarm_javascript skills

2012 doomsday countdown code turns out to be nothing but a false alarm_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:46:251283browse

This doomsday countdown source code has a JS controller on the program. It is a countdown timer used for display on web pages. You can set the start time of the end of the world. You can directly copy the doomsday countdown source code on the web page and use it without downloading. , you can use it directly


[Ctrl A Select all Note: If you need to introduce external Js, you need to refresh to execute
]
The code is as follows:


There is also

<script> <br>function downTime(){ <br>var timeout = window.setTimeout(downTime, 100); <br>var endTime=new Date("12-21-2012 0:0:0");//Change to your timing date<br>var today=new Date(); <br>var timeold =(endTime.getTime()-today.getTime()); <br>if(timeold <= 100){ <BR>window.clearTimeout(timeout); <BR>document.getElementByIdx_x("container").innerHTML = "It turns out it's okay, it was a false alarm!"; <BR>return; <BR>} <BR>var sectimeold=timeold/1000; <BR>var secondsold=Math.floor(sectimeold); <BR>var msPerDay= 24*60*60*1000; <BR>var e_daysold=timeold/msPerDay; <BR>var daysold=Math.floor(e_daysold); <BR>var e_hrsold=(e_daysold-daysold)*24; <BR>var hrsold =Math.floor(e_hrsold); <BR>var e_minsold=(e_hrsold-hrsold)*60; <BR>var minsold=Math.floor((e_hrsold-hrsold)*60); <BR>var e_seconds=(e_minsold- minsold)*60; <BR>var seconds=Math.floor((e_minsold-minsold)*60); <BR>var decimals = Math.floor((e_seconds-seconds)*10); <BR>document.getElementByIdx_x( "downtime").innerHTML=daysold "days" hrsold "hours" minsold "minutes" seconds "." decimals "seconds" ; <BR>} <BR>downTime(); <BR></script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn