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

  • Home
  • SEARCH
  • 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 8536861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:45:53+00:00 2026-06-11T10:45:53+00:00

When I load my page, no clock appears no matter what I do. I

  • 0

When I load my page, no clock appears no matter what I do. I have created two buttons. If I remove the button which refers to the stopTime() function which contains clearTimeout(t); then my clock appears. If I put the button back my clock won’t work.

<body onload="getTime()">


  <script>

  var t;

  function getTime() 
  {  
     var time = new Date();

     var hour = time.getHours();
     var minute = time.getMinutes();
     var second = time.getSeconds(); 

     hour = checkTime(hour);
     minute = checkTime(minute);
     second = checkTime(second);

     var actualtime = hour + ":" + minute + ":" + second;

     document.getElementById("time").innerHTML = actualtime;

     t = setTimeout(function(){getTime()},1000);
  }

  function checkTime(i)
  {
      if ( i < 10 )
          i = "0" + i;
      return i;
  }

  function stopTime();
  {
      clearTimeout(t);
  }

  </script>


</body>

</html>

Thanks in advance!

  • 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-11T10:45:54+00:00Added an answer on June 11, 2026 at 10:45 am

    You have a syntax error here:

    function stopTime();
    {
        clearTimeout(t);
    }
    

    Take out the ; at the end of your function stopTime().

    Fixing that, your code runs fine for me.

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

Sidebar

Related Questions

i have many events such as $('.hidefile').click(function (event) { On page load and on
I have the following function that I want to run on page load and
I have a textbox and a button. On page load I select one column
how to load the other HTML page when i click a button? i'm using
I'm trying to load page and then remove some elements in it. While doing
I have a page with several sets of radio buttons that are used to
I generated two buttons and put them into a list of buttons.. List<Button> buttons
To improve the performance/responsiveness of my website I have implemented a partial page load
I've got an button that on page load reads "Show Content", and when clicked,
I have this html which works if it is in the page when it

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.