<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript">
//<![CDATA[
var time = null;
window.onload = function() {
timerDisplay = document.getElementById('timer');
time = parseFloat(timerDisplay.innerHTML);
time = isNaN(time)?5:time; // default time
timerDisplay.innerHTML = time.toFixed(2).replace('.', ':');
setInterval(countdown, 1000);
}
function countdown() {
if(time > 0.01) {
time -= 0.01;
if(time%1 > 0.59) time = Math.floor(time) + 0.59;
timerDisplay.innerHTML = time.toFixed(2).replace('.', ':');
} else timerDisplay.innerHTML = "0:00";
}
//]]>
</script>
</head>
<body>
Time left: <span id="timer"><?= $ti ?></span>
</body>
</html>
|