<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> JavaScript брояч </title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script type="text/javascript">
function starttimer() {
var divid = document.getElementById('timer');
if (!divid.innerHTML) { document.getElementById('timer').innerHTML = '<img src=\'numbers/10.png\' alt=\'10\' id=\'numb\' />'; }
calctimer();
}
function calctimer() {
var divida = document.getElementById('numb');
if (divida.alt > 1) { var newnumb = divida.alt - 1; divida.src = 'numbers/' + newnumb + '.png'; divida.alt = newnumb; setTimeout("calctimer();",1000); }
else { divida.src = 'numbers/r.png'; divida.alt = 'Ready'; }
}
</script>
</head>
<body>
<p onClick="starttimer();">Натисни ме</p><hr><div id="timer"></div>
</body>
</html>