Javascript, countdown timer and display text

前端 未结 3 1492
耶瑟儿~
耶瑟儿~ 2021-02-09 03:16

I am making a countdown timer with JavaScript.

Here is my script.

var seconds_left = 10;
var interval = setInterval(function() {
    document.getElementB         


        
相关标签:
3条回答
  • 2021-02-09 03:54
    document.getElementById('timer_div').innerHTML = "You are Ready!";
    
    0 讨论(0)
  • 2021-02-09 03:57
    var seconds_left = 10;
    var interval = setInterval(function() {
        document.getElementById('timer_div').innerHTML = --seconds_left;
    
        if (seconds_left <= 0)
        {
            document.getElementById('timer_div').innerHTML = 'You are ready';
            clearInterval(interval);
        }
    }, 1000);
    

    Here is the Example

    0 讨论(0)
  • 2021-02-09 04:13
    <script>
        TargetDate = "12/31/2020 5:00 AM";
        DisplayFormat = "%%D%% Days, %%H%% Hours, %%M%% Minutes, %%S%% Seconds.";
        FinishMessage = "It is finally here!";
    </script>
    <script src="//scripts.hashemian.com/js/countdown.js"></script>
    
    0 讨论(0)
提交回复
热议问题