CodePudding user response:
Use the timer timerCodePudding user response:
The $(document). Ready (function () {Var t1=new Date (" 2019-01-01 01:00:00 ");
Var t2=new Date (" 2019-01-01 03:00:00 ")
//t3=how many seconds remaining test this value should be the start of the test record to the database
//read out from the database when the test start time if there is no default for 2 hours, 7200 seconds js calculation for milliseconds so divided by 1000
Var t3=(t2 - t1)/1000;
Var _timeInterval;
_timeInterval=setInterval (function () {
T3 -
If (t3==0)
{
Window. ClearInterval (_timeInterval);//stop the timer
Alert (" perform the function of papers ")
} the else
{
//not to submit the time countdown display
Var havetime=parseInt (t3/3600) + "hour" + parseInt (t3) % 3600/60 + "minutes" + parseInt (t3%3600% 60) + "seconds"
The console. The log (havetime)
}
}, 1000)
})
Put a piece of Javascript to implement the function of the code is similar
CodePudding user response:
https://www.cnblogs.com/yinluhui0229/archive/2012/08/20/2648313.htmlCodePudding user response:
Just start launch test, record in timing time,CodePudding user response:
Bs or cs