Ok, so here is what I've gathered together so far. I've got a countdown timer, that at the end of 180 seconds it executes the function clearit. The problem I'm having I would like to put a user chosen variable in place of the 180. Any help would be greatly appreciated.
Thank you.
<script type="text/javascript">
function starttimer8() {
/* set your parameters(
number to countdown from,
pause between counts in milliseconds,
function to execute when finished
)
*/
startCountDown(180, 1000, clearit);
}
function startCountDown(i, p, f) {
// store parameters
var pause = p;
var fn = f;
// make reference to div
var countDownObj = document.getElementById("countDown");
if (countDownObj == null) {
// error
alert("div not found, check your id");
// bail
return;
}
countDownObj.count = function(i) {
// write out count
this.innerHTML = i;
if (i == 0) {
// execute function
fn();
// stop
return;
}
setTimeout(function() {
// repeat
countDownObj.count(i - 1);
},
pause
);
}
// set it going
countDownObj.count(i);
}
</script>
<div id="countDown"></div>