script type text javascript function timer var obj document getElement

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
<script type="text/javascript">
function timer(){
var obj=document.getElementById('RealButton');
var RealTimer = obj.innerHTML.substr(20,2);
RealTimer=RealTimer - 1;
if (RealTimer<0) RealTimer=0;
obj.innerHTML = 'Обновить страницу [ '+RealTimer+' ]';
if (RealTimer==0) { location.replace("http://RealAdmin.ru/coding/button-timer-js.html"); setTimeout(function(){},1000); }
else {setTimeout(timer,1000);}
}
setTimeout(timer,1000);
</script>