2014-04-14 126 views
0

朋友你好我想提出一個即將 HTML模板,並使用倒數計時器, 我要讓時間自動 刷新1秒後HTML模板,使用倒數計時器

我想使JavaScript的執行atumatically

<!DOCTYPE HTML> 
    <html lang="en"> 
    <head> 
     <meta charset="utf-8"> 
     <meta name="viewport" content="width=device-width"> 

     <meta name="keywords" content="nineforo,9foro"> 
     <title>9foro | Coming soon</title> 
     <link rel="stylesheet" href="" type="text/css"> 
     <link href='http://fonts.googleapis.com/css?family=Philosopher:700' rel='stylesheet' type='text/css'> 
     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
     <script type="text/javascript" src="jquery.countdown.pack.js"></script> 
     <!--[if lt IE 9]> 
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> 
     <![endif]-->  
     <script type="text/javascript"> 
      $(function() { 
       $('#countdown').countdown({until: new Date(2014, 5 - 1, 1)}); 
      }); 
     </script> 
    </head> 

    <body> 
    <div id="wrapper"> 
     <header> 
      <h2>9fORO</h2> 

     <section id="timer"> 
      <p>Estimated time remaining before official launch:</p> 
      <div id="countdown"></div> 
     </section> 
    </div> 
    </body> 
    </html> 
+0

U可以嘗試使用[window.setInterval(http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_win_setinterval) – Arvind

回答

0

找不到您的腳本jquery.countdown.pack.js。但你可以嘗試https://github.com/hilios/jQuery.countdown

<!DOCTYPE HTML> 
<html lang="en"> 
    <head> 
     <meta charset="utf-8"> 
     <meta name="viewport" content="width=device-width"> 

     <meta name="keywords" content="nineforo,9foro"> 
     <title>9foro | Coming soon</title> 
     <link rel="stylesheet" href="" type="text/css"> 
     <link href='http://fonts.googleapis.com/css?family=Philosopher:700' rel='stylesheet' type='text/css'> 
     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
     <script type="text/javascript" src="jquery.countdown.pack.js"></script> 
     <script type="text/javascript" src="https://raw.githubusercontent.com/hilios/jQuery.countdown/master/dist/jquery.countdown.min.js"></script> 
     <!--[if lt IE 9]> 
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> 
     <![endif]-->  
     <script type="text/javascript"> 
      $(function() { 
       $('#countdown').countdown("2014/14/04",function(event){ 
        $(this).html(event.strftime('%D days %H:%M:%S')); 
       }); 
      }); 
     </script> 
    </head> 

    <body> 
    <div id="wrapper"> 
     <header> 
      <h2>9fORO</h2> 

     <section id="timer"> 
      <p>Estimated time remaining before official launch:</p> 
      <div id="countdown"></div> 
     </section> 
    </div> 
    </body> 
</html>