game/testtimerm.php

34 lines
578 B
PHP
Raw Normal View History

2022-06-06 21:30:34 +00:00
<!DOCTYPE html>
<html>
<body>
<button onclick="atack()" id="go_btn">go</button>
<script>
var cgo = 100;
var tgo;
var timer_is_on = 0;
timedCount();
function timedCount() {
document.getElementById("go_btn").innerHTML = cgo;
if (cgo > 0)
{
tgo = setTimeout(timedCount, 50);
cgo = cgo - 10;
}
else
{
clearTimeout(tgo);
timer_is_on = 0;
document.getElementById("go_btn").innerHTML = 'go!!!';
}
}
function stopCount() {
clearTimeout(tgo);
timer_is_on = 0;
}
</script>
</body>
</html>