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 8269853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T06:22:06+00:00 2026-06-08T06:22:06+00:00

I have a clock that I want to keep ticking, except when I put

  • 0

I have a clock that I want to keep ticking, except when I put “break” in to the “seconds” parameter. When I do put “break”, the clock breaks for a second, then keeps ticking. I want to have it stop ticking, and I have no idea what the problem is. For the record, I call this function on page load, and then whenever the user clicks elements on the page. It gets screwy after they click something.

var seconds;

function countdown_clock(seconds) {
    if (seconds != "break") {
        countdown(seconds);

        seconds = seconds;
    }
}

function displaymessage() {
    alert("Your Time Has Expired");
}

function countdown(seconds) {
    if (seconds != "break") {
        Time_Left = seconds;
        format = 1;

        if (Time_Left < 0)
            Time_Left = 0;

        switch (format) {
            case 0:
                //The simplest way to display the time left.
                $("div#ClockCountdown").html(Time_Left + ' seconds');
                break;
            case 1:
                //More detailed.
                Next_time = Time_Left - 1;
                minutes = Math.floor(Time_Left / 60);
                Time_Left %= 60;
                seconds = Time_Left;

                mps = 's';
                sps = 's';
                earlyzero = '';
                latezero = '';
                //ps is short for plural suffix.

                if (minutes == 1) mps = '';
                if (seconds == 1) sps = '';
                if (seconds < 10) earlyzero = '0';
                //                    if(seconds == 10) latezero ='0';

                //                    document.all.countdown.innerHTML = minutes + ' minute' + mps + ' and ';
                //                    document.all.countdown.innerHTML += seconds + ' second' + sps;

                innerHTML = minutes + ':';
                innerHTML += earlyzero + seconds;
                $("div#ClockCountdown").html(innerHTML + "nonbroken!");
                break;
            default:
                $("div#ClockCountdown").html(Time_Left + ' seconds');
        }

        if (Next_time == 0) {
            displaymessage();
            window.location.href = "navigation.php?nav=video_timeout";
        }
        else {
            setTimeout('countdown(' + Next_time + ');', 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-08T06:22:09+00:00Added an answer on June 8, 2026 at 6:22 am

    You also have to clear the timeout. Do something like this:

    var timeout;
    function countdown(seconds) {
        if (seconds == "break") {
            clearTimeout(timeout);
        }
        // other things
        if( Next_time == 0) {
            displaymessage();
            window.location.href ="navigation.php?nav=video_timeout";
        } else {
            timeout = setTimeout('countdown(' + Next_time + ');', 1000);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that i want an administrator to fill out, then click
I have an click function that I want to trigger outside of the function
I have a div that I want when user click on a button slideUp
I have the following code that works great for row click, but I want
Suppose, I want to have a link or a button that when user click
I have users selecting a DateTime using a caldendar/clock popup that allows them to
I have a repeating timer that runs down a clock. During the clock running
I'm looking into this clock. I have no experience with the js that comes
I have an Eclipse project where I want to keep my Java project built
I have a script that write a iframe into the page. I want to

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.