Ok so I have this code so far for a time in time out button, I want it to post within the app and show the wait time. I dont know where to go from here but it just is not working
.
<html>
<head>
<script type = "text/javascript">
var timeInSecs;
var ticker;
function start(){
var s = document.getElementById("period").value;
document.getElementById("period").disabled = true;
s = 4 // FOR TESTING
startTimer(s);
}
function startTimer(secs){
timeInSecs = parseInt(secs);
ticker = setInterval("tick()",1000);
tick(); // to start counter display right away
}
function tick() {
var secs = timeInSecs;
if (secs>0) {
timeInSecs--;
showTime(secs);
}
else {
timeInSecs--;
document.getElementById("countdown").style.color = "red";
document.getElementById("countdown").innerHTML = "You have exceeded your time by " + Math.abs(timeInSecs) + " seconds";
}
}
function showTime(secs) {
var hours= Math.floor(secs/3600);
secs %= 3600;
var mins = Math.floor(secs/60);
secs %= 60;
var result = ((hours < 10 ) ? "0" : "" ) + hours + ":" + ( (mins < 10) ? "0" : "" ) + mins
+ ":" + ( (secs < 10) ? "0" : "" ) + secs;
document.getElementById("countdown").innerHTML = result;
}
</script>
</head>
<select id = "period" onchange = "start()">
<option value = "0">Select time required</option>
<option value = "900">15 minutes</option>
<option value = "1800">30 minutes</option>
<option value = "2700">45 minutes</option>
<option value = "3600">60 minutes</option>
<option value = "4500">75 minutes</option>
<option value = "5400">90 minutes</option>
<option value = "6300">105 minutes</option>
<option value = "7200">120 minutes</option>
</select>
<span id="countdown" style="font-weight: bold;"></span>
</body>
</html>
I want to use this for different parts of the app and would like to be able to assign this to a specific function