How to add remaining hours or original estimate time in my page? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to add remaining hours or original estimate time in my page?

I create a examination system. and now need remaining time system for examination

3rd Jul 2018, 12:51 PM
Shohidul Islam
Shohidul Islam - avatar
2 Answers
0
Show your attempt
3rd Jul 2018, 2:26 PM
TurtleShell
TurtleShell - avatar
0
Easy example: ---------- html: ---------- <!doctype> <html> <head> <script type="text/javascript" src="script.js"></script> </head> <body> <p id="time">10</p> <button onclick="start();">start</button> <body> </html> ---------- javascript ---------- var sec=10; function count() { if(sec>0){ sec--; } else{ sec=10; alert("End of time"); clearInterval(time); } document.getElementById("time").innerHTML= sec; } function start(){ time = setInterval(count, 1000); } That count from 10 to 0 seconds after is display alert "end of time". Hours and minutes can be added by adding variables.
3rd Jul 2018, 3:09 PM
Dawid
Dawid - avatar