<!DOCTYPE HTML>

<html>
<head>
<meta charset=UTF-8>
<title>recursion</title>
<style type="text/css">
</style>
<script type="text/javascript">
onload = function ()
{
setTimeout (function ()
{
var date = new Date();
var year = date.getFullYear();
date.setHours (date.getHours () + 1);
var m = date.getMonth () + 1;
m = m < 10 ? "0" + m : m;
var d = date.getDate ();
d = d < 10 ? "0" + d : d;
var h = date.getHours ();
h = h < 10 ? "0" + h : h;
var mm = date.getMinutes ();
mm = mm < 10 ? "0" + mm : mm;
var ss = date.getSeconds();
ss = ss < 10 ? "0" + ss : ss;
txt.value = year + "-" + m + "-" + d + " " + h + ":" + mm + ":" + ss;
}, 1000);

}

function shizhong(enddatestring) {
var date = new Date();
var year = date.getFullYear();
date.setHours(date.getHours() + 1);
var m = date.getMonth() + 1;
m = m < 10 ? "0" + m : m;
var d = date.getDate();
d = d < 10 ? "0" + d : d;
var h = date.getHours();
h = h < 10 ? "0" + h : h;
var mm = date.getMinutes();
mm = mm < 10 ? "0" + mm : mm;
var ss = date.getSeconds();
ss = ss < 10 ? "0" + ss : ss;
txt.value = year + "-" + m + "-" + d + " " + h + ":" + mm + ":" + ss;
setTimeout("shizhong('" + date + "')", 1000);
}

function dianji() {
var selectDate = new Date();
var year = selectDate.getFullYear();
selectDate.setHours(selectDate.getHours() + 1);
var m = selectDate.getMonth() + 1;
m = m < 10 ? "0" + m : m;
var d = selectDate.getDate();
d = d < 10 ? "0" + d : d;
var h = selectDate.getHours();
h = h < 10 ? "0" + h : h;
var mm = selectDate.getMinutes();
mm = mm < 10 ? "0" + mm : mm;
var ss = selectDate.getSeconds();
ss = ss < 10 ? "0" + ss : ss;
var checkDate = new Date(year + "-" + m + "-" + d + " " + h + ":" + mm + ":" + ss);

alert(checkDate);
}
</script>
<script type="text/javascript">
function countDown(secs) {
var sp1 = document.getElementById('sp1');
sp1.innerHTML = secs;
if (--secs > 0) {
setTimeout("countDown(" + secs + ")", 1000);
}
else {
sp1.innerHTML =" The countdown is complete ";
}
}
</script>
</head>
<body>
<div style="margin:10px;">
<input type="text" id="txt" />
<input id="btnDianJi" type="button" value="get current date" onclick="dianji();" />
</div>
<div style="margin:10px;">
<input type="text" id="txt1" value="5" style="width:50px;" />
<span id="sp1"></span>
<script type="text/javascript">
var start = document.getElementById("txt1").value;
countDown(start);
shizhong('2015-09-30 13:00:00');
</script>
</div>

</body>
</html>

js The clock & More articles on countdown

  1. The countdown is js Realization count down js Jquery

    by zhangxinxu from http://www.zhangxinxu.com This paper addresses :http://www.zhangxinxu.com/wordpress/?p=987 One . A group in full swing ...

  2. A simple js Realize the countdown function

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. js Time countdown

    Looking at other examples on the Internet , I think the writing is a little complicated , Hard to understand , So I wrote a . I wanted to package it as jquery plug-in unit , But I think because the function is very simple , There's no need to make jquery plug-in unit , You don't need to introduce jqery library , It's direct here ...

  4. js Realize countdown and time object

    JS To achieve the countdown effect, the code is as follows : <!doctype html> <html> <head> <meta charset="utf-8"> ...

  5. js Verification Code count down 60 second

    js Verification Code count down 60 second <input type="button" id="btn" value=" Get the verification code for free " /> & ...

  6. [ZZ+CH] Html5 canvas+js The clock

    All in all, new Blog After entering the country , I'm back in my old habit , It's all about custom space , Put something in . I think I made one when I was a freshman Javascript The time display on the screen , Now I want to make a clock , Now, of course, the old and the cunning , I'll go to see if there's any predecessors who have written about it . predecessors ...

  7. JS Achieve countdown ( Days , when , branch , second )

    <!DOCTYPE html> <html> <head>   <meta charset="utf-8" >   <titl ...

  8. Use html+css+js Achieve countdown , Turn on the countdown to your pain

    Use html+css+js Achieve countdown , Turn on the countdown to your pain design sketch : This is the countdown to my pain , Purring All right. , No matter how painful it is, we still have to share the code , The code is as follows , Copy and use : <!DOCTYPE html> &l ...

  9. js Web page countdown to seconds

    Web real time countdown , Accurate to seconds , It's the same as counting down the number of days . A very useful one js count down ! Web real time countdown , Accurate to seconds , It's the same as counting down the number of days .js Countdown is generally used for group buying on mall websites , Special sale , It's available in many places ! Hope to bring you ...

Random recommendation

  1. python Learning notes ( Foundation two : notes 、 User input 、 Format output )

    notes A single :# Multiple lines : Up and down 3 Two consecutive single or double quotes 3 Except for multiple lines of comments , You can also print multiple lines give an example : msg = ''' name = "Alex Li" name2 = name ...

  2. Android in JNI Some of the common Method explain

    Android JNI and NDK Relationship   1. what JNI Java Native Interface (JNI) The standard is java Part of the platform , It allows the Java Code interacts with code written in other languages .JNI It's local programming ...

  3. Linux Shell Logical operators and expressions

    Shell Logical operators involve the following types , As long as you choose , It can solve many of our complicated judgments , Get twice the result with half the effort . One . logic 1. Logical judgment on files and directories -f Commonly used . Judge 『 file 』 Is it a common document , such as : if [ ...

  4. AsyncTask Asynchronous loading and HttpURLConnection Network request data

    // Access to network data     private void huodeshuju() { // Here is using threads , Have commented out         /*new Thread(){            public void ...

  5. Delphi Redis Client

    https://github.com/danieleteti/delphiredisclient

  6. CentOS7 linux Next yum install redis And the use of

    1. install redis database yum install redis 2. download fedora Of epel Warehouse yum install epel-release 3. start-up redis service systemctl star ...

  7. Python The road of the whole stack ---- Function advanced ---- Closure

    About closure , That is, the function definition and function expression are in the function body of another function ( Nested function ). and , These inner functions have access to all the local variables declared in the outer function they are in . Parameters . When one of these internal functions is called outside of containing them , It will form a closed loop ...

  8. BZOJ.3140.[HNOI2013] disinfect ( Bipartite map matching In Hungary, )

    Topic link It's not hard to think that it must be cut one piece at a time . If it's a plane , It's easy to think of doing bipartite graph matching directly . about 3 Dimensional ? You can find min(a,b,c) The maximum value of is only \(\sqrt[3]{n}≈17\), What we mean by this minimum is ...

  9. AMAZON Data sets

    http://snap.stanford.edu/data/amazon/productGraph/categoryFiles/

  10. Ubuntu14.04 + Text-Detection-with-FRCN(CPU)

    operating system : yt@yt-MS-:~$ cat /etc/issue Ubuntu LTS \n \l Python edition : yt@yt-MS-:~$ python --version Python pi ...