I want to ask is it possible to do break statement first then to the continue statement?
Like example, I want to do counting and have a break at the certain time then continue the counting back and stop back.Is it possible for me to do that?

I already use the setTimeout but the problem is I want the break and start time counting in automatically.The current system I do is it needs to click the start button and stop button.It is hard for user to come to the pc and put start button then come to pc again to stop the system many times.

Can anyone suggest to me any solution?
Thanks in advance!

5 Years
Discussion Span
Last Post by markdean.expres

You have to include in your question the determinant of when your counting will stop and resume. Example, will it stop after 20 seconds, 5 minutes etc. What is your program doing? Is it like a stopwatch?

make it clear so that we can possibly help... I am willing to help here.


Actually I create the system called Production Monitoring System. This system is use to monitor the production for the car for everyday.Now I have to display the plan for today how much they are target, the actual production they get for that day and the plan by now which is counting every 8minutes for 1 production.I already make the plan for today and the actual.But my problem is plan by now interface.I can count it for every 8minutes but we must consider what the start time like 8.15 a.m they start the production then in 10 a.m they stop for the rest and start back in 10.30 a.m and so on.In the rest time I don't want the system counting and continue the counting after the break.I don't have any idea how to set the time so that they can start counting and have break and continue automatically without interfere any user.Can you help me?I also attach you the screenshot about the interface.

Attachments pms.jpg 37.75 KB
var d = new Date();

var hours = d.getHours();
var mins = d.getMinutes();
//measure them in minutes since midnight

var curMins = (hours*60)+mins;

if(curMins >= 495 && curMins <= 600){//495 == 8:15  600 == 10:00
//do counter

if(curMins >= 630 && curMins <= 720){//630 == 10:30 720 == 12:00
//do counter

also bear in mind javascript uses the client-side systems clock so make sure it stays reasonably accurate

Edited by Biiim: uses system clock

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.