Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8546439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:01:21+00:00 2026-06-11T13:01:21+00:00

I have a count down script, but I have 2 issues. 1. my countdown

  • 0

I have a count down script, but I have 2 issues. 1. my countdown never reaches 0 and stops so i get a continous negative number. 2. the counter only displays in chrome and not firefox or internet explorer.How do I fix these two isses?

var sec, min, hr, day, timer, expireDate;

sec = 1000;
min = 60 * 1000;
hr = 60 * 60 * 1000;
day = 24 * 60 * 60 * 1000;
timer;
expireDate = new Date('Mon Sep 17 2012 14:26:00 GMT-0700');

timer = setInterval(function() {
    var currentDate, countdown, days, hours, minutes, seconds;
    currentDate = new Date();
    countdown = expireDate - currentDate;
    if (countdown === 0 ) {
        window.clearInterval(timer); 
        document.getElementById('countdown').innerHTML = 'EXPIRED!';
    }

    days = Math.floor(countdown / day);
    hours = Math.floor((countdown % day) / hr);
    minutes = Math.floor((countdown % hr) / min);
    seconds = Math.floor((countdown % min) / sec);
    console.log(countdown);
    document.getElementById('countdown').innerHTML = days + " " + hours + " " + minutes + " " + seconds;
}, 1000);​
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:01:23+00:00Added an answer on June 11, 2026 at 1:01 pm

    As stated by others, you should be using < 0.

    In addition, once your expired condition is met, you are immediately overwriting the EXPIRED! label, so you will never see it. You will need to move the code following the if into an else or simply return within the if.

    if (countdown <= 0 ) {
        window.clearInterval(timer); 
        document.getElementById('countdown').innerHTML = 'EXPIRED!';
    } else {
        days = Math.floor(countdown / day);
        hours = Math.floor((countdown % day) / hr);
        minutes = Math.floor((countdown % hr) / min);
        seconds = Math.floor((countdown % min) / sec);
        console.log(countdown);
        document.getElementById('countdown').innerHTML = days + " " + hours + " " + minutes + " " + seconds;
    }
    

    And finally, the reason it wont’ work in IE is likely the console.log. IE will fail on this if you do not have a console open at the time. Simply remove the console.log line and this works just fine in IE.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple count down script. The code works in chrome but not
I have the following script: Timer=0; function countdown(auctionid){ var auctions; var divs; Timer=Timer+1; if((Timer%10==0)||(Timer==1)){
I have got a piece of code, that should countdown some number (in this
I have to count the number of overlapping dimers (AA, AG, AC, AT, GA,
I have made this timer script but I can't seem to make it so
I have used a jQuery script in order to have a countdown script on
I have a somewhat working countdown script already with a defined time (using new
In my android project, I have a countdown that randomizes a boolean for an
I am creating an online exam page for my project. I have a countdown
I have a client who needs somebody to develop a countdown widget for their

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.