game/testtimerm.php
2022-06-07 00:30:34 +03:00

34 lines
578 B
PHP

<!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>