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
2 Antworten
0
Show your attempt
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.